fix(cpu): allow for select values to overflow

FuzzARM found these operations which panicked, when they should
have overflowed. These are now fixed

n = 8000
This commit is contained in:
2022-02-02 22:49:33 -04:00
parent 800ed6f1a7
commit c6bb4bf8e1
2 changed files with 3 additions and 3 deletions

View File

@@ -145,7 +145,7 @@ fn armSbc(comptime S: bool, cpu: *Arm7tdmi, rd: u4, left: u32, right: u32, old_c
pub fn sbc(comptime S: bool, cpu: *Arm7tdmi, left: u32, right: u32, old_carry: u1) u32 {
// TODO: Make your own version (thanks peach.bot)
const subtrahend = @as(u64, right) - old_carry + 1;
const subtrahend = @as(u64, right) -% old_carry +% 1;
const result = @truncate(u32, left -% subtrahend);
if (S) {