Fix potential shift by negative number.

This commit is contained in:
Unknown W. Brackets 2015-04-08 11:49:02 -07:00
parent 10626e356d
commit 3cb474047b

View File

@ -572,7 +572,7 @@ namespace MIPSInt
{ //TODO: verify
int x = 31;
int count=0;
while (!(R(rs) & (1<<x)) && x >= 0)
while (x >= 0 && !(R(rs) & (1<<x)))
{
count++;
x--;
@ -584,7 +584,7 @@ namespace MIPSInt
{ //TODO: verify
int x = 31;
int count=0;
while ((R(rs) & (1<<x)) && x >= 0)
while (x >= 0 && (R(rs) & (1<<x)))
{
count++;
x--;