use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.
the class UnsignedLongTest method testTimes.
@Test
public void testTimes() {
UnsignedLong fortyTwo = new UnsignedLong(42);
Assert.assertEquals(42 * 42, fortyTwo.times(42).asLong());
Assert.assertEquals(0xffff_ffff_ffff_fff0L, fortyTwo.times(0x618618618618618L).asLong());
}
use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.
the class UnsignedLongTest method testIsLessThan.
@Test
public void testIsLessThan() {
UnsignedLong fortyTwo = new UnsignedLong(42);
Assert.assertTrue(fortyTwo.isLessThan(45));
Assert.assertFalse(fortyTwo.isLessThan(42));
Assert.assertFalse(fortyTwo.isLessThan(40));
Assert.assertTrue(fortyTwo.isLessThan(0xffff_ffff_ffff_ffffL));
UnsignedLong longUnsigned = new UnsignedLong(0x8000_7777_0000_8888L);
Assert.assertTrue(longUnsigned.isLessThan(0xffff_ffff_ffff_ffffL));
Assert.assertFalse(longUnsigned.isLessThan(42));
Assert.assertFalse(longUnsigned.isLessThan(0x8000_0777_0000_8888L));
Assert.assertFalse(longUnsigned.isLessThan(0x8000_7777_0000_8888L));
}
use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.
the class UnsignedLongTest method testTimesException.
@Test(expected = ArithmeticException.class)
public void testTimesException() {
UnsignedLong fortyTwo = new UnsignedLong(42);
fortyTwo.times(0x618618618618619L);
}
use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.
the class UnsignedLongTest method testIsLessOrEqualTo.
@Test
public void testIsLessOrEqualTo() {
UnsignedLong fortyTwo = new UnsignedLong(42);
Assert.assertTrue(fortyTwo.isLessOrEqualTo(45));
Assert.assertTrue(fortyTwo.isLessOrEqualTo(42));
Assert.assertFalse(fortyTwo.isLessOrEqualTo(40));
Assert.assertTrue(fortyTwo.isLessOrEqualTo(0xffff_ffff_ffff_ffffL));
UnsignedLong longUnsigned = new UnsignedLong(0x8000_7777_0000_8888L);
Assert.assertTrue(longUnsigned.isLessOrEqualTo(0xffff_ffff_ffff_ffffL));
Assert.assertFalse(longUnsigned.isLessOrEqualTo(42));
Assert.assertFalse(longUnsigned.isLessOrEqualTo(0x8000_0777_0000_8888L));
Assert.assertTrue(longUnsigned.isLessOrEqualTo(0x8000_7777_0000_8888L));
}
use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.
the class UnsignedLongTest method testWrappingTimes.
@Test
public void testWrappingTimes() {
UnsignedLong fortyTwo = new UnsignedLong(42);
Assert.assertEquals(0x1a, fortyTwo.wrappingTimes(0x618618618618619L).asLong());
}
Aggregations