From 9262ddfc135f14f9c50080cae9b9c12f43b5f0da Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 19 Jul 2015 13:25:50 -0700 Subject: [PATCH] Avoid any possible shifts by 32. --- Core/MIPS/ARM/ArmCompALU.cpp | 2 +- Core/MIPS/ARM64/Arm64CompALU.cpp | 3 +-- Core/MIPS/MIPSInt.cpp | 7 ++++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/MIPS/ARM/ArmCompALU.cpp b/Core/MIPS/ARM/ArmCompALU.cpp index 0fe3d7c87b..6232044290 100644 --- a/Core/MIPS/ARM/ArmCompALU.cpp +++ b/Core/MIPS/ARM/ArmCompALU.cpp @@ -533,7 +533,7 @@ namespace MIPSComp int pos = _POS; int size = _SIZE + 1; - u32 mask = (1 << size) - 1; + u32 mask = 0xFFFFFFFFUL >> (32 - size); // Don't change $zr. if (rt == 0) diff --git a/Core/MIPS/ARM64/Arm64CompALU.cpp b/Core/MIPS/ARM64/Arm64CompALU.cpp index 0e891e164d..bcbfca5bda 100644 --- a/Core/MIPS/ARM64/Arm64CompALU.cpp +++ b/Core/MIPS/ARM64/Arm64CompALU.cpp @@ -431,8 +431,7 @@ void Arm64Jit::Comp_Special3(MIPSOpcode op) { int pos = _POS; int size = _SIZE + 1; - // Workaround for a compiler bug. - u32 mask = size == 32 ? 0xFFFFFFFF : (1 << size) - 1; + u32 mask = 0xFFFFFFFFUL >> (32 - size); // Don't change $zr. if (rt == 0) diff --git a/Core/MIPS/MIPSInt.cpp b/Core/MIPS/MIPSInt.cpp index e246901752..60ce72b299 100644 --- a/Core/MIPS/MIPSInt.cpp +++ b/Core/MIPS/MIPSInt.cpp @@ -866,14 +866,15 @@ namespace MIPSInt case 0x0: //ext { int size = _SIZE + 1; - R(rt) = (R(rs) >> pos) & ((1<> (32 - size); + R(rt) = (R(rs) >> pos) & sourcemask; } break; case 0x4: //ins { int size = (_SIZE + 1) - pos; - int sourcemask = (1 << size) - 1; - int destmask = sourcemask << pos; + u32 sourcemask = 0xFFFFFFFFUL >> (32 - size); + u32 destmask = sourcemask << pos; R(rt) = (R(rt) & ~destmask) | ((R(rs)&sourcemask) << pos); } break;