Attempt the POSIX `ssize_t` type for signed addr compares.

This commit is contained in:
unknown 2015-09-17 19:58:49 -04:00
parent 8f9e963cb0
commit c04f856b79
1 changed files with 9 additions and 5 deletions

View File

@ -133,13 +133,17 @@ void Cheat_r4300iOpcodeNoMessage(p_func FunctAddress, char * FunctName) {
void x86_SetBranch8b(void * JumpByte, void * Destination) { void x86_SetBranch8b(void * JumpByte, void * Destination) {
/* calculate 32-bit relative offset */ /* calculate 32-bit relative offset */
signed int n = (BYTE*)Destination - ((BYTE*)JumpByte + 1); size_t n = (BYTE*)Destination - ((BYTE*)JumpByte + 1);
SSIZE_T signed_n = (SSIZE_T)n;
/* check limits, no pun intended */ /* check limits, no pun intended */
if (n > 0x80 || n < -0x7F) { if (signed_n > +128 || signed_n < -127) {
CompilerWarning("FATAL: Jump out of 8b range %i (PC = %04X)", n, CompilePC); CompilerWarning(
} else "FATAL: Jump out of 8b range %i (PC = %04X)", n, CompilePC
*(BYTE*)(JumpByte) = (BYTE)n; );
} else {
*(uint8_t *)(JumpByte) = (uint8_t)(n & 0xFF);
}
} }
void x86_SetBranch32b(void * JumpByte, void * Destination) { void x86_SetBranch32b(void * JumpByte, void * Destination) {