From f08da850c7ee641026288925fac970a2af51ba52 Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Sat, 13 Jul 2019 23:33:37 +0300 Subject: [PATCH] thumb: Fix overflowing multiplication Former-commit-id: 5dbd45f9fd3811726aad9c32444f0dcf42d0b8be --- src/arm7tdmi/thumb/exec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arm7tdmi/thumb/exec.rs b/src/arm7tdmi/thumb/exec.rs index b0ec658..07f8339 100644 --- a/src/arm7tdmi/thumb/exec.rs +++ b/src/arm7tdmi/thumb/exec.rs @@ -82,7 +82,7 @@ impl Core { for _ in 0..m { self.add_cycle(); } - self.gpr[insn.rd()] = (op1 * op2) as u32; + self.gpr[insn.rd()] = op1.wrapping_mul(op2) as u32; Ok(CpuPipelineAction::IncPC) }