Mercurial > hg > truffle
view graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/CRC32_updateBytes.java @ 11238:a7c7b0bd0557
add intrinsics for java.util.zip.CRC32 (GRAAL-385)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 06 Aug 2013 23:36:36 +0200 |
parents | 5c153c59ba62 |
children |
line wrap: on
line source
/* * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.oracle.graal.jtt.jdk; import java.io.*; import java.util.zip.*; import org.junit.*; import com.oracle.graal.jtt.*; /** * Tests compiled call to {@link CRC32#updateBytes(int, byte[], int, int)}. */ @SuppressWarnings("javadoc") public class CRC32_updateBytes extends JTTTest { public static long test(byte[] input) { CRC32 crc = new CRC32(); crc.update(input, 0, input.length); return crc.getValue(); } @Test public void run0() throws Throwable { runTest("test", "some string".getBytes()); } @Test public void run1() throws Throwable { String classfileName = CRC32_updateBytes.class.getSimpleName().replace('.', '/') + ".class"; InputStream s = CRC32_updateBytes.class.getResourceAsStream(classfileName); byte[] buf = new byte[s.available()]; new DataInputStream(s).readFully(buf); runTest("test", buf); } }