MCPcopy
hub / github.com/google/brotli / updateCrc64

Method updateCrc64

java/org/brotli/integration/BundleHelper.java:81–90  ·  view source on GitHub ↗

Rolls CRC64 calculation. CRC64(data) = -1 ^ updateCrc64((... updateCrc64(-1, firstBlock), ...), lastBlock); This simple and reliable checksum is chosen to make is easy to calculate the same value across the variety of languages (C++, Java, Go, ...).

(long crc, byte[] data, int offset, int length)

Source from the content-addressed store, hash-verified

79 * across the variety of languages (C++, Java, Go, ...).
80 */
81 public static long updateCrc64(long crc, byte[] data, int offset, int length) {
82 for (int i = offset; i < offset + length; ++i) {
83 long c = (crc ^ (long) (data[i] & 0xFF)) & 0xFF;
84 for (int k = 0; k < 8; k++) {
85 c = ((c & 1) == 1) ? CRC_64_POLY ^ (c >>> 1) : c >>> 1;
86 }
87 crc = c ^ (crc >>> 8);
88 }
89 return crc;
90 }
91
92 /**
93 * Calculates CRC64 of stream contents.

Callers 1

fingerprintStreamMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected