Skip to content
Permalink
Browse files
Merge pull request #9346 from Sintendo/jitarm64ub
JitArm64: Fix signed bitwise left shift UB
  • Loading branch information
leoetlino committed Dec 26, 2020
2 parents d2f9991 + 567357e commit dcc313f
Showing 1 changed file with 2 additions and 5 deletions.
@@ -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));
@@ -1353,7 +1350,7 @@ void JitArm64::srawx(UGeckoInstruction inst)
{
amount &= 0x1F;
gpr.SetImmediate(a, i >> amount);
ComputeCarry(amount != 0 && i < 0 && (i << (32 - amount)));
ComputeCarry(amount != 0 && i < 0 && (u32(i) << (32 - amount)));
}

if (inst.Rc)

0 comments on commit dcc313f

Please sign in to comment.