Debian Codegraph @

src/org/tukaani/xz/lz/CRC32Hash.java

raw symbols SCIP
1 // SPDX-License-Identifier: 0BSD
2 // SPDX-FileCopyrightText: The XZ for Java authors and contributors
3 // SPDX-FileContributor: Lasse Collin <[email protected]>
4 // SPDX-FileContributor: Igor Pavlov <https://7-zip.org/>
5
6 package org.tukaani.xz.lz;
7
8 /**
9 * Provides a CRC32 table using the polynomial from IEEE 802.3.
10 */
11 class CRC32Hash {
12 private static final int CRC32_POLY = 0xEDB88320;
13
14 static final int[] crcTable = new int[256];
15
16 static {
17 for (int i = 0; i < 256; ++i) {
18 int r = i;
19
20 for (int j = 0; j < 8; ++j) {
21 if ((r & 1) != 0)
22 r = (r >>> 1) ^ CRC32_POLY;
23 else
24 r >>>= 1;
25 }
26
27 crcTable[i] = r;
28 }
29 }
30 }