Lines Matching defs:crc
175 public static long update_byteLoop(long crc, byte[] buf, int offset) {
176 return update_byteLoop(crc, buf, offset, buf.length-offset);
180 public static long update_byteLoop(long crc, byte[] buf, int offset, int length) {
183 crc = update_singlebyte(crc, polyBitsShifted, buf[i]);
185 return crc;
193 public static long update_singlebyte(long crc, long polynomial, int val) {
194 crc = (crc ^ -1L) & 0x00000000ffffffffL; // use 1's complement of crc
195 crc = crc ^ (val&0xff); // XOR in next byte from stream
197 boolean bitset = (crc & 0x01L) != 0;
199 crc = crc>>1;
201 crc = crc ^ polynomial;
202 crc = crc & 0x00000000ffffffffL;
205 crc = (crc ^ -1L) & 0x00000000ffffffffL; // revert taking 1's complement
206 return crc;
209 private static void report(String s, Checksum crc, long crcReference) {
210 System.out.printf("%s: crc = %08x, crcReference = %08x\n",
211 s, crc.getValue(), crcReference);
214 private static void check(Checksum crc, long crcReference) throws Exception {
215 if (crc.getValue() != crcReference) {
216 System.err.printf("ERROR: crc = %08x, crcReference = %08x\n",
217 crc.getValue(), crcReference);