From 24a13b4021dd29477b835fcc45706bcbb827e08a Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 8 Dec 2013 20:42:20 -0800 Subject: [PATCH] Fixing carry. --- src/alloy/backend/ivm/ivm_intcode.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/alloy/backend/ivm/ivm_intcode.cc b/src/alloy/backend/ivm/ivm_intcode.cc index 7d73a4aef..24dde849b 100644 --- a/src/alloy/backend/ivm/ivm_intcode.cc +++ b/src/alloy/backend/ivm/ivm_intcode.cc @@ -1900,7 +1900,7 @@ int Translate_VECTOR_COMPARE_UGE(TranslationContext& ctx, Instr* i) { return DispatchToC(ctx, i, fns[i->flags]); } -#define CHECK_DID_CARRY(v1, v2) ((v2) > ~(v1)) +#define CHECK_DID_CARRY(v1, v2) (((uint64_t)v2) > ~((uint64_t)v1)) #define ADD_DID_CARRY(a, b) CHECK_DID_CARRY(a, b) uint32_t IntCode_ADD_I8_I8(IntCodeState& ics, const IntCode* i) { int8_t a = ics.rf[i->src1_reg].i8; int8_t b = ics.rf[i->src2_reg].i8;