| 50 | } |
| 51 | |
| 52 | void crcspeed16little_init(crcfn16 crcfn, uint16_t table[8][256]) { |
| 53 | uint16_t crc; |
| 54 | |
| 55 | /* generate CRCs for all single byte sequences */ |
| 56 | for (int n = 0; n < 256; n++) { |
| 57 | table[0][n] = crcfn(0, &n, 1); |
| 58 | } |
| 59 | |
| 60 | /* generate nested CRC table for future slice-by-8 lookup */ |
| 61 | for (int n = 0; n < 256; n++) { |
| 62 | crc = table[0][n]; |
| 63 | for (int k = 1; k < 8; k++) { |
| 64 | crc = table[0][(crc >> 8) & 0xff] ^ (crc << 8); |
| 65 | table[k][n] = crc; |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /* Reverse the bytes in a 64-bit word. */ |
| 71 | static inline uint64_t rev8(uint64_t a) { |
no outgoing calls
no test coverage detected