Fix edge case in the division engine, fix edge case in the CPU (#1003)

* Fixed division edge case: Div64/32 and Div64/64 set the remainder to 0 if dividend == INT64_MIN && divisor == -1

* Fixed CPU edge case where ARM9 ALU ops would switch to Thumb even when they shouldn't

* Only clear the lowest bit of the jump address in ALU ops with rd==15 (on recommendation of RSDuck)
This commit is contained in:
wheremyfoodat
2021-02-20 00:58:41 +02:00
committed by GitHub
parent a8b2c22306
commit 03b465c5e2
2 changed files with 14 additions and 12 deletions

View File

@ -1758,6 +1758,7 @@ void DivDone(u32 param)
else if (num == -0x8000000000000000 && den == -1)
{
*(s64*)&DivQuotient[0] = 0x8000000000000000;
*(s64*)&DivRemainder[0] = 0;
}
else
{
@ -1779,6 +1780,7 @@ void DivDone(u32 param)
else if (num == -0x8000000000000000 && den == -1)
{
*(s64*)&DivQuotient[0] = 0x8000000000000000;
*(s64*)&DivRemainder[0] = 0;
}
else
{