summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorSintendo <bram.speeckaert@gmail.com>2020-12-21 11:05:22 +0100
committerSintendo <bram.speeckaert@gmail.com>2020-12-21 11:05:22 +0100
commit567357e12d0033ccc39ea5b896f075aa029bb3df (patch)
tree7af75156114121a7b56482e5bfabe6b2e22322bf /Source
parent97eb616719f81b008bd8beab5340d998d565c75b (diff)
JitArm64: srawix - Fix undefined behavior
Signed bitwise left shift invokes UB when shifting a negative value.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp
index 56e567a372..8a2062b239 100644
--- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp
+++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp
@@ -631,10 +631,7 @@ void JitArm64::srawix(UGeckoInstruction inst)
s32 imm = (s32)gpr.GetImm(s);
gpr.SetImmediate(a, imm >> amount);
- if (amount != 0 && (imm < 0) && (imm << (32 - amount)))
- ComputeCarry(true);
- else
- ComputeCarry(false);
+ ComputeCarry(amount != 0 && (imm < 0) && (u32(imm) << (32 - amount)));
if (inst.Rc)
ComputeRC0(gpr.GetImm(a));