Describe the bug
I have some code using the the exts.b instruction (extend sign byte):
06006706 b0 4d bsr loadOverlay int loadOverlay(void)
06006708 64 e3 _mov r14,r4
0600670a 60 0e exts.b r0,r0
0600670c 20 08 tst r0,r0
0600670e 8b 15 bf LAB_0600673c
06006710 e3 01 mov 0x1,r3
06006712 a0 13 bra LAB_0600673c
06006714 2e 31 _mov.w r3,@r14
The decompilation generated is:
iVar1 = loadOverlay();
iVar1 = (int)(char)((uint)iVar1 >> 8);
if (iVar1 != 0) {
return iVar1;
}
*psParm1 = 1;
Now what is very unclear to me is where the >> 8 come from. loadOverlay is setup to return an int.
@VGKintsugi might be interesting to you?
@yaz0r good eye. Looks like the exts.b and exts.w had a syntax issue and were accidentally masking off the low byte(s) instead of sign extending them. This PR should fix
Gave the PR a shot, worked great. Thanks!
Thanks @mumbel
Most helpful comment
@yaz0r good eye. Looks like the exts.b and exts.w had a syntax issue and were accidentally masking off the low byte(s) instead of sign extending them. This PR should fix