fix two if statements checking range of number wrong (#494)

This commit is contained in:
goeiecool9999 2022-11-17 15:42:08 +01:00 committed by GitHub
parent 2adabcb936
commit 57c8dec335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -421,7 +421,7 @@ static void PPCInterpreter_MULLWO(PPCInterpreter_t* hCPU, uint32 opcode)
PPC_OPC_TEMPL3_XO();
sint64 result = (sint64)hCPU->gpr[rA] * (sint64)hCPU->gpr[rB];
hCPU->gpr[rD] = (uint32)result;
if (result < -0x80000000ll && result > 0x7FFFFFFFLL)
if (result < -0x80000000ll || result > 0x7FFFFFFFLL)
{
hCPU->spr.XER |= XER_SO;
hCPU->spr.XER |= XER_OV;

View File

@ -653,7 +653,7 @@ public:
{
immD = ep.Evaluate(svExpressionPart);
sint32 imm = (sint32)immD;
if (imm < -32768 && imm > 32767)
if (imm < -32768 || imm > 32767)
{
std::string msg = fmt::format("\"{}\" evaluates to offset out of range (Valid range is -32768 to 32767)", svExpressionPart);
ppcAssembler_setError(assemblerCtx->ctx, msg);