fix(cpu): perform MUL with u64s, throw away upper 32 bits
This commit is contained in:
parent
b07eb22b86
commit
b27bf4a85c
|
@ -12,7 +12,8 @@ pub fn multiply(comptime A: bool, comptime S: bool) InstrFn {
|
|||
const rs = opcode >> 8 & 0xF;
|
||||
const rm = opcode & 0xF;
|
||||
|
||||
const result = cpu.r[rm] * cpu.r[rs] + if (A) cpu.r[rn] else 0;
|
||||
const temp: u64 = @as(u64, cpu.r[rm]) * @as(u64, cpu.r[rs]) + if (A) cpu.r[rn] else 0;
|
||||
const result = @truncate(u32, temp);
|
||||
cpu.r[rd] = result;
|
||||
|
||||
if (S) {
|
||||
|
|
Loading…
Reference in New Issue