Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/aarch64/LongShiftTests.java
32282 views
1
public class LongShiftTests {
2
3
private static long test_shl(long a, long b) {
4
return a << b;
5
}
6
7
private static long test_shlc1(long a) {
8
return a << 1;
9
}
10
11
private static long test_shlc65(long a) {
12
return a << 65;
13
}
14
15
private static long test_shr(long a, long b) {
16
return a >> b;
17
}
18
19
private static long test_shrc1(long a) {
20
return a >> 1;
21
}
22
23
private static long test_shrc65(long a) {
24
return a >> 65;
25
}
26
27
private static long test_ushr(long a, long b) {
28
return a >>> b;
29
}
30
31
private static long test_ushrc1(long a) {
32
return a >>> 1;
33
}
34
35
private static long test_ushrc65(long a) {
36
return a >>> 65;
37
}
38
39
private static void assertThat(boolean assertion) {
40
if (! assertion) {
41
throw new AssertionError();
42
}
43
}
44
45
public static void main(String[] args) {
46
47
assertThat(test_shl(32, 2) == 128);
48
assertThat(test_shl(0x8000000000000000L, 1) == 0);
49
assertThat(test_shl(0x4000000000000000L, 1) == 0x8000000000000000L);
50
assertThat(test_shl(0x4000000000000000L, 65) == 0x8000000000000000L);
51
52
assertThat(test_shr(32, 2) == 8);
53
assertThat(test_shr(1, 1) == 0);
54
assertThat(test_shr(0x8000000000000000L, 1) == 0xc000000000000000L);
55
assertThat(test_shr(0x4000000000000000L, 65) == 0x2000000000000000L);
56
57
assertThat(test_ushr(32, 2) == 8);
58
assertThat(test_ushr(1, 1) == 0);
59
assertThat(test_ushr(0x8000000000000000L, 1) == 0x4000000000000000L);
60
assertThat(test_ushr(0x4000000000000000L, 65) == 0x2000000000000000L);
61
62
assertThat(test_shlc1(32) == 64);
63
assertThat(test_shlc1(0x8000000000000000L) == 0);
64
assertThat(test_shlc1(0x4000000000000000L) == 0x8000000000000000L);
65
assertThat(test_shlc65(0x4000000000000000L) == 0x8000000000000000L);
66
67
assertThat(test_shrc1(32) == 16);
68
assertThat(test_shrc1(1) == 0);
69
assertThat(test_shrc1(0x8000000000000000L) == 0xc000000000000000L);
70
assertThat(test_shrc65(0x4000000000000000L) == 0x2000000000000000L);
71
72
assertThat(test_ushrc1(32) == 16);
73
assertThat(test_ushrc1(1) == 0);
74
assertThat(test_ushrc1(0x8000000000000000L) == 0x4000000000000000L);
75
assertThat(test_ushrc65(0x4000000000000000L) == 0x2000000000000000L);
76
}
77
}
78
79