From 70179984d09f6ab94fcc6b36dc8add44c8b910b8 Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Mon, 1 Jul 2019 19:25:42 +0300 Subject: [PATCH] cpu: arm: Fix alu_add_update_carry function Woopsie Former-commit-id: 2da74e4bfd4b59a2885519a99f4b2c3d83031ee2 --- src/arm7tdmi/arm/exec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arm7tdmi/arm/exec.rs b/src/arm7tdmi/arm/exec.rs index b332ff8..203229b 100644 --- a/src/arm7tdmi/arm/exec.rs +++ b/src/arm7tdmi/arm/exec.rs @@ -131,7 +131,7 @@ impl Core { } fn alu_add_update_carry(a: i32, b: i32, carry: &mut bool) -> i32 { - let res = a.wrapping_sub(b); + let res = a.wrapping_add(b); *carry = res < a; res }