From 57c8dec33589ff46b57041ea1c2cd9b4342e30eb Mon Sep 17 00:00:00 2001 From: goeiecool9999 <7033575+goeiecool9999@users.noreply.github.com> Date: Thu, 17 Nov 2022 15:42:08 +0100 Subject: [PATCH] fix two if statements checking range of number wrong (#494) --- src/Cafe/HW/Espresso/Interpreter/PPCInterpreterALU.hpp | 2 +- src/Cemu/PPCAssembler/ppcAssembler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cafe/HW/Espresso/Interpreter/PPCInterpreterALU.hpp b/src/Cafe/HW/Espresso/Interpreter/PPCInterpreterALU.hpp index dbbdb08d..fca872ec 100644 --- a/src/Cafe/HW/Espresso/Interpreter/PPCInterpreterALU.hpp +++ b/src/Cafe/HW/Espresso/Interpreter/PPCInterpreterALU.hpp @@ -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; diff --git a/src/Cemu/PPCAssembler/ppcAssembler.cpp b/src/Cemu/PPCAssembler/ppcAssembler.cpp index e84c9970..1e209fbc 100644 --- a/src/Cemu/PPCAssembler/ppcAssembler.cpp +++ b/src/Cemu/PPCAssembler/ppcAssembler.cpp @@ -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);