| OLD | NEW |
| 1 /* CRC32 implementation by Gary S. Brown. See license claim below. */ | 1 /* CRC32 implementation by Gary S. Brown. See license claim below. */ |
| 2 | 2 |
| 3 /* ============================================================= */ | 3 /* ============================================================= */ |
| 4 /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */ | 4 /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */ |
| 5 /* code or tables extracted from it, as desired without restriction. */ | 5 /* code or tables extracted from it, as desired without restriction. */ |
| 6 /* */ | 6 /* */ |
| 7 /* First, the polynomial itself and its table of feedback terms. The */ | 7 /* First, the polynomial itself and its table of feedback terms. The */ |
| 8 /* polynomial is */ | 8 /* polynomial is */ |
| 9 /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ | 9 /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ |
| 10 /* */ | 10 /* */ |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 /* Returns a 32-bit CRC of the contents of the buffer. */ | 99 /* Returns a 32-bit CRC of the contents of the buffer. */ |
| 100 uint32_t Crc32(const void *buffer, uint32_t len) { | 100 uint32_t Crc32(const void *buffer, uint32_t len) { |
| 101 uint8_t *byte = (uint8_t*)buffer; | 101 uint8_t *byte = (uint8_t*)buffer; |
| 102 uint32_t i; | 102 uint32_t i; |
| 103 uint32_t value = ~0U; | 103 uint32_t value = ~0U; |
| 104 | 104 |
| 105 for (i = 0; i < len; ++i) | 105 for (i = 0; i < len; ++i) |
| 106 value = crc32_tab[(value ^ byte[i]) & 0xff] ^ (value >> 8); | 106 value = crc32_tab[(value ^ byte[i]) & 0xff] ^ (value >> 8); |
| 107 return value ^ ~0U; | 107 return value ^ ~0U; |
| 108 } | 108 } |
| OLD | NEW |