Avoid any possible shifts by 32.

This commit is contained in:
Unknown W. Brackets 2015-07-19 13:25:50 -07:00
parent cd842ac21f
commit 9262ddfc13
3 changed files with 6 additions and 6 deletions

View File

@ -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)

View File

@ -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)

View File

@ -866,14 +866,15 @@ namespace MIPSInt
case 0x0: //ext
{
int size = _SIZE + 1;
R(rt) = (R(rs) >> pos) & ((1<<size) - 1);
u32 sourcemask = 0xFFFFFFFFUL >> (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;