diff options
Diffstat (limited to 'libjava/testsuite/libjava.lang')
-rw-r--r-- | libjava/testsuite/libjava.lang/BuiltinBitCount.jar | bin | 0 -> 1033 bytes | |||
-rw-r--r-- | libjava/testsuite/libjava.lang/BuiltinBitCount.java | 51 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/BuiltinBitCount.out | 0 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/BuiltinReverseBytes.jar | bin | 0 -> 1126 bytes | |||
-rw-r--r-- | libjava/testsuite/libjava.lang/BuiltinReverseBytes.java | 62 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/BuiltinReverseBytes.out | 0 |
6 files changed, 113 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.lang/BuiltinBitCount.jar b/libjava/testsuite/libjava.lang/BuiltinBitCount.jar Binary files differnew file mode 100644 index 0000000..0f6591c --- /dev/null +++ b/libjava/testsuite/libjava.lang/BuiltinBitCount.jar diff --git a/libjava/testsuite/libjava.lang/BuiltinBitCount.java b/libjava/testsuite/libjava.lang/BuiltinBitCount.java new file mode 100644 index 0000000..bcafd31 --- /dev/null +++ b/libjava/testsuite/libjava.lang/BuiltinBitCount.java @@ -0,0 +1,51 @@ +class BuiltinBitCount +{ + public static int popcount(int x) + { + return Integer.bitCount(x); + } + + public static int popcountl(long x) + { + return Long.bitCount(x); + } + + public static void main(String[] args) + { + if (Integer.bitCount(0) != 0) + throw new Error(); + if (Integer.bitCount(8) != 1) + throw new Error(); + if (Integer.bitCount(123456) != 6) + throw new Error(); + if (Integer.bitCount(-1) != 32) + throw new Error(); + + if (Long.bitCount(0) != 0) + throw new Error(); + if (Long.bitCount(8) != 1) + throw new Error(); + if (Long.bitCount(123456) != 6) + throw new Error(); + if (Long.bitCount(-1) != 64) + throw new Error(); + + if (popcount(0) != 0) + throw new Error(); + if (popcount(8) != 1) + throw new Error(); + if (popcount(123456) != 6) + throw new Error(); + if (popcount(-1) != 32) + throw new Error(); + + if (popcountl(0) != 0) + throw new Error(); + if (popcountl(8) != 1) + throw new Error(); + if (popcountl(123456) != 6) + throw new Error(); + if (popcountl(-1) != 64) + throw new Error(); + } +} diff --git a/libjava/testsuite/libjava.lang/BuiltinBitCount.out b/libjava/testsuite/libjava.lang/BuiltinBitCount.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libjava/testsuite/libjava.lang/BuiltinBitCount.out diff --git a/libjava/testsuite/libjava.lang/BuiltinReverseBytes.jar b/libjava/testsuite/libjava.lang/BuiltinReverseBytes.jar Binary files differnew file mode 100644 index 0000000..283a178 --- /dev/null +++ b/libjava/testsuite/libjava.lang/BuiltinReverseBytes.jar diff --git a/libjava/testsuite/libjava.lang/BuiltinReverseBytes.java b/libjava/testsuite/libjava.lang/BuiltinReverseBytes.java new file mode 100644 index 0000000..0d2e332 --- /dev/null +++ b/libjava/testsuite/libjava.lang/BuiltinReverseBytes.java @@ -0,0 +1,62 @@ +class BuiltinReverseBytes +{ + public static short bswap16(short x) + { + return Short.reverseBytes(x); + } + + public static int bswap32(int x) + { + return Integer.reverseBytes(x); + } + + public static long bswap64(long x) + { + return Long.reverseBytes(x); + } + + public static void main(String[] args) + { + if (Short.reverseBytes((short)0) != (short)0) + throw new Error(); + if (Short.reverseBytes((short)0x1234) != (short)0x3412) + throw new Error(); + if (Short.reverseBytes((short)-1) != (short)-1) + throw new Error(); + + if (Integer.reverseBytes(0) != 0) + throw new Error(); + if (Integer.reverseBytes(0x12345678) != 0x78563412) + throw new Error(); + if (Integer.reverseBytes(-1) != -1) + throw new Error(); + + if (Long.reverseBytes(0L) != 0L) + throw new Error(); + if (Long.reverseBytes(0x123456789abcde0fL) != 0x0fdebc9a78563412L) + throw new Error(); + if (Long.reverseBytes(-1L) != -1L) + throw new Error(); + + if (bswap16((short)0) != (short)0) + throw new Error(); + if (bswap16((short)0x1234) != (short)0x3412) + throw new Error(); + if (bswap16((short)-1) != (short)-1) + throw new Error(); + + if (bswap32(0) != 0) + throw new Error(); + if (bswap32(0x12345678) != 0x78563412) + throw new Error(); + if (bswap32(-1) != -1) + throw new Error(); + + if (bswap64(0L) != 0L) + throw new Error(); + if (bswap64(0x123456789abcde0fL) != 0x0fdebc9a78563412L) + throw new Error(); + if (bswap64(-1L) != -1L) + throw new Error(); + } +} diff --git a/libjava/testsuite/libjava.lang/BuiltinReverseBytes.out b/libjava/testsuite/libjava.lang/BuiltinReverseBytes.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libjava/testsuite/libjava.lang/BuiltinReverseBytes.out |