Mercurial > hg > truffle
changeset 11247:4172b595e374
more CRC32 intrinsification tests
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 07 Aug 2013 16:35:47 +0200 |
parents | 2d4df4c43ae2 |
children | b5f6188d79c5 |
files | graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CRC32SubstitutionsTest.java |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CRC32SubstitutionsTest.java Wed Aug 07 16:35:16 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CRC32SubstitutionsTest.java Wed Aug 07 16:35:47 2013 +0200 @@ -48,15 +48,18 @@ test("update", "some string".getBytes()); } - public static long updateBytes(byte[] input) { + public static long updateBytes(byte[] input, int offset, int length) { CRC32 crc = new CRC32(); - crc.update(input, 0, input.length); + crc.update(input, offset, length); return crc.getValue(); } @Test public void test2() { - test("updateBytes", "some string".getBytes()); + byte[] buf = "some string".getBytes(); + int off = 0; + int len = buf.length; + test("updateBytes", buf, off, len); } @Test @@ -65,7 +68,10 @@ InputStream s = CRC32SubstitutionsTest.class.getResourceAsStream(classfileName); byte[] buf = new byte[s.available()]; new DataInputStream(s).readFully(buf); - test("updateBytes", buf); + test("updateBytes", buf, 0, buf.length); + for (int offset = 1; offset < buf.length; offset++) { + test("updateBytes", buf, offset, buf.length - offset); + } } }