jdk/src/java.base/share/classes/java/util/zip/CRC32.java
changeset 32649 2ee9017c7597
parent 31671 362e0c0acece
child 45434 4582657c7260
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
   125     public long getValue() {
   125     public long getValue() {
   126         return (long)crc & 0xffffffffL;
   126         return (long)crc & 0xffffffffL;
   127     }
   127     }
   128 
   128 
   129     @HotSpotIntrinsicCandidate
   129     @HotSpotIntrinsicCandidate
   130     private native static int update(int crc, int b);
   130     private static native int update(int crc, int b);
   131 
   131 
   132     private static int updateBytes(int crc, byte[] b, int off, int len) {
   132     private static int updateBytes(int crc, byte[] b, int off, int len) {
   133         updateBytesCheck(b, off, len);
   133         updateBytesCheck(b, off, len);
   134         return updateBytes0(crc, b, off, len);
   134         return updateBytes0(crc, b, off, len);
   135     }
   135     }
   136 
   136 
   137     @HotSpotIntrinsicCandidate
   137     @HotSpotIntrinsicCandidate
   138     private native static int updateBytes0(int crc, byte[] b, int off, int len);
   138     private static native int updateBytes0(int crc, byte[] b, int off, int len);
   139 
   139 
   140     private static void updateBytesCheck(byte[] b, int off, int len) {
   140     private static void updateBytesCheck(byte[] b, int off, int len) {
   141         if (len <= 0) {
   141         if (len <= 0) {
   142             return;  // not an error because updateBytesImpl won't execute if len <= 0
   142             return;  // not an error because updateBytesImpl won't execute if len <= 0
   143         }
   143         }
   159         updateByteBufferCheck(addr);
   159         updateByteBufferCheck(addr);
   160         return updateByteBuffer0(alder, addr, off, len);
   160         return updateByteBuffer0(alder, addr, off, len);
   161     }
   161     }
   162 
   162 
   163     @HotSpotIntrinsicCandidate
   163     @HotSpotIntrinsicCandidate
   164     private native static int updateByteBuffer0(int alder, long addr,
   164     private static native int updateByteBuffer0(int alder, long addr,
   165                                                 int off, int len);
   165                                                 int off, int len);
   166 
   166 
   167     private static void updateByteBufferCheck(long addr) {
   167     private static void updateByteBufferCheck(long addr) {
   168         // Performs only a null check because bounds checks
   168         // Performs only a null check because bounds checks
   169         // are not easy to do on raw addresses.
   169         // are not easy to do on raw addresses.