mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
classlib: fix issue with integer unsigned right shift
This commit is contained in:
parent
9f349385ec
commit
c39efdc6d7
|
@ -755,7 +755,8 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor {
|
||||||
visitBinary(expr, ">>", false);
|
visitBinary(expr, ">>", false);
|
||||||
break;
|
break;
|
||||||
case UNSIGNED_RIGHT_SHIFT:
|
case UNSIGNED_RIGHT_SHIFT:
|
||||||
visitBinary(expr, ">>>", false);
|
// JavaScript not casts -2147483648 >>> 0 to 2147483648, which is not 32 bit integer.
|
||||||
|
visitBinary(expr, ">>>", true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,4 +180,9 @@ public class IntegerTest {
|
||||||
assertEquals("1111111111111111111111111111111", Integer.toString(Integer.MAX_VALUE, 2));
|
assertEquals("1111111111111111111111111111111", Integer.toString(Integer.MAX_VALUE, 2));
|
||||||
assertEquals("-10000000000000000000000000000000", Integer.toString(Integer.MIN_VALUE, 2));
|
assertEquals("-10000000000000000000000000000000", Integer.toString(Integer.MIN_VALUE, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void unsignedRightShift() {
|
||||||
|
assertEquals(Integer.MIN_VALUE, Integer.MIN_VALUE >>> Integer.parseInt("0"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user