From 39b46c1d3431ae25f74d54382fcbae46b95ec05e Mon Sep 17 00:00:00 2001 From: dmcoles Date: Tue, 3 Sep 2013 17:37:39 +0100 Subject: [PATCH] math.floor in divs rounds down with negative numbers. Replaced with double binary not --- sae/cpu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sae/cpu.js b/sae/cpu.js index 456b9ae..bc39b74 100644 --- a/sae/cpu.js +++ b/sae/cpu.js @@ -1063,7 +1063,7 @@ function CPU() { regs.pc = fault.pc; return exception(5); } else { - var quo = Math.floor(d / s); + var quo = ~~(d / s); if (quo < 0) quo += 0x10000; @@ -5253,4 +5253,4 @@ function CPU() { cycle_spc(cpu_cycles); } } -} \ No newline at end of file +}