From d660babecd5dc17a957eb6361be35978ebe129fe Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:11:44 -0300 Subject: [PATCH] fix(cpu): purposely overflow when calculating PC during branch --- src/cpu.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpu.zig b/src/cpu.zig index 07f2a99..bb1a2d5 100644 --- a/src/cpu.zig +++ b/src/cpu.zig @@ -213,7 +213,7 @@ fn comptimeBranch(comptime L: bool) InstrFn { cpu.r[14] = cpu.r[15] - 4; } - cpu.r[15] = cpu.fakePC() + util.u32SignExtend(24, opcode << 2); + cpu.r[15] = cpu.fakePC() +% util.u32SignExtend(24, opcode << 2); } }.branch; }