all repos — mgba @ da488b3c2bd3cd1fda4efb3fa3b4739176eb5b73

mGBA Game Boy Advance Emulator

DS: Fix DIV
Vicki Pfau vi@endrift.com
Mon, 20 Feb 2017 15:26:06 -0800
commit

da488b3c2bd3cd1fda4efb3fa3b4739176eb5b73

parent

17ec2ceee2282837d810dac6630445226b267f20

1 files changed, 2 insertions(+), 5 deletions(-)

jump to
M src/ds/ds.csrc/ds/ds.c

@@ -89,13 +89,10 @@ LOAD_64LE(denominator, DS9_REG_DIV_DENOM_0, ds->memory.io9);

bool max = false; switch (ds->memory.io9[DS9_REG_DIVCNT >> 1] & 0x3) { case 0: - denominator &= 0xFFFFFFFFLL; + numerator = (int64_t)(int32_t) numerator; case 1: case 3: - numerator &= 0xFFFFFFFFLL; - if (numerator == INT32_MIN) { - max = true; - } + denominator = (int64_t)(int32_t) denominator; break; } if (numerator == INT64_MIN) {