mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-15 03:40:56 +01:00
fix signed long multiply and negative flag
This commit is contained in:
parent
b51e07b643
commit
cce814a3a7
1 changed files with 6 additions and 6 deletions
|
@ -9,16 +9,16 @@ module ARM
|
||||||
rm = bits(instr, 0..3)
|
rm = bits(instr, 0..3)
|
||||||
|
|
||||||
res = if signed
|
res = if signed
|
||||||
(@r[rm].to_i32!.to_i64 &* @r[rs]).to_u64 # todo make this just bit math...
|
@r[rm].to_i32!.to_i64 &* @r[rs].to_i32!
|
||||||
else
|
else
|
||||||
(0_u64 | @r[rm]) &* @r[rs]
|
@r[rm].to_u64 &* @r[rs]
|
||||||
end
|
end
|
||||||
res &+= (0_u64 | @r[rdhi]) << 32 | @r[rdlo] if accumulate
|
res &+= @r[rdhi].to_u64 << 32 | @r[rdlo] if accumulate
|
||||||
@r[rdhi] = 0_u32 | res >> 32
|
@r[rdhi] = (res >> 32).to_u32!
|
||||||
@r[rdlo] = 0xFFFFFFFF_u32 & res
|
@r[rdlo] = res.to_u32!
|
||||||
if set_conditions
|
if set_conditions
|
||||||
@cpsr.zero = res == 0
|
@cpsr.zero = res == 0
|
||||||
@cpsr.negative = bit?(res, 63)
|
@cpsr.negative = bit?(@r[rdhi], 31)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue