Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/aarch64/LongShiftTests.java
32282 views
public class LongShiftTests {12private static long test_shl(long a, long b) {3return a << b;4}56private static long test_shlc1(long a) {7return a << 1;8}910private static long test_shlc65(long a) {11return a << 65;12}1314private static long test_shr(long a, long b) {15return a >> b;16}1718private static long test_shrc1(long a) {19return a >> 1;20}2122private static long test_shrc65(long a) {23return a >> 65;24}2526private static long test_ushr(long a, long b) {27return a >>> b;28}2930private static long test_ushrc1(long a) {31return a >>> 1;32}3334private static long test_ushrc65(long a) {35return a >>> 65;36}3738private static void assertThat(boolean assertion) {39if (! assertion) {40throw new AssertionError();41}42}4344public static void main(String[] args) {4546assertThat(test_shl(32, 2) == 128);47assertThat(test_shl(0x8000000000000000L, 1) == 0);48assertThat(test_shl(0x4000000000000000L, 1) == 0x8000000000000000L);49assertThat(test_shl(0x4000000000000000L, 65) == 0x8000000000000000L);5051assertThat(test_shr(32, 2) == 8);52assertThat(test_shr(1, 1) == 0);53assertThat(test_shr(0x8000000000000000L, 1) == 0xc000000000000000L);54assertThat(test_shr(0x4000000000000000L, 65) == 0x2000000000000000L);5556assertThat(test_ushr(32, 2) == 8);57assertThat(test_ushr(1, 1) == 0);58assertThat(test_ushr(0x8000000000000000L, 1) == 0x4000000000000000L);59assertThat(test_ushr(0x4000000000000000L, 65) == 0x2000000000000000L);6061assertThat(test_shlc1(32) == 64);62assertThat(test_shlc1(0x8000000000000000L) == 0);63assertThat(test_shlc1(0x4000000000000000L) == 0x8000000000000000L);64assertThat(test_shlc65(0x4000000000000000L) == 0x8000000000000000L);6566assertThat(test_shrc1(32) == 16);67assertThat(test_shrc1(1) == 0);68assertThat(test_shrc1(0x8000000000000000L) == 0xc000000000000000L);69assertThat(test_shrc65(0x4000000000000000L) == 0x2000000000000000L);7071assertThat(test_ushrc1(32) == 16);72assertThat(test_ushrc1(1) == 0);73assertThat(test_ushrc1(0x8000000000000000L) == 0x4000000000000000L);74assertThat(test_ushrc65(0x4000000000000000L) == 0x2000000000000000L);75}76}777879