Lines Matching refs:crc
58 crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256]) argument
61 # define DO_CRC(x) crc = t0[(crc ^ (x)) & 255] ^ (crc >> 8)
67 # define DO_CRC(x) crc = t0[((crc >> 24) ^ (x)) & 255] ^ (crc << 8)
106 q = crc ^ *++b; /* use pre increment for speed */
108 crc = DO_CRC4;
110 crc = DO_CRC8;
112 crc ^= DO_CRC4;
128 return crc;
146 static inline u32 __pure crc32_le_generic(u32 crc, unsigned char const *p, argument
153 crc ^= *p++;
155 crc = (crc >> 1) ^ ((crc & 1) ? polynomial : 0);
159 crc ^= *p++;
160 crc = (crc >> 2) ^ tab[0][crc & 3];
161 crc = (crc >> 2) ^ tab[0][crc & 3];
162 crc = (crc >> 2) ^ tab[0][crc & 3];
163 crc = (crc >> 2) ^ tab[0][crc & 3];
167 crc ^= *p++;
168 crc = (crc >> 4) ^ tab[0][crc & 15];
169 crc = (crc >> 4) ^ tab[0][crc & 15];
174 crc ^= *p++;
175 crc = (crc >> 8) ^ tab[0][crc & 255];
178 crc = (__force u32) __cpu_to_le32(crc);
179 crc = crc32_body(crc, p, len, tab);
180 crc = __le32_to_cpu((__force __le32)crc);
182 return crc;
186 u32 __pure __weak crc32_le(u32 crc, unsigned char const *p, size_t len) argument
188 return crc32_le_generic(crc, p, len, NULL, CRC32_POLY_LE);
190 u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len) argument
192 return crc32_le_generic(crc, p, len, NULL, CRC32C_POLY_LE);
195 u32 __pure __weak crc32_le(u32 crc, unsigned char const *p, size_t len) argument
197 return crc32_le_generic(crc, p, len,
200 u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len) argument
202 return crc32_le_generic(crc, p, len,
243 static u32 __attribute_const__ crc32_generic_shift(u32 crc, size_t len, argument
251 crc = (crc >> 1) ^ (crc & 1 ? polynomial : 0);
255 return crc;
260 crc = gf2_multiply(crc, power, polynomial);
270 return crc;
273 u32 __attribute_const__ crc32_le_shift(u32 crc, size_t len) argument
275 return crc32_generic_shift(crc, len, CRC32_POLY_LE);
278 u32 __attribute_const__ __crc32c_le_shift(u32 crc, size_t len) argument
280 return crc32_generic_shift(crc, len, CRC32C_POLY_LE);
294 static inline u32 __pure crc32_be_generic(u32 crc, unsigned char const *p, argument
301 crc ^= *p++ << 24;
303 crc =
304 (crc << 1) ^ ((crc & 0x80000000) ? polynomial :
309 crc ^= *p++ << 24;
310 crc = (crc << 2) ^ tab[0][crc >> 30];
311 crc = (crc << 2) ^ tab[0][crc >> 30];
312 crc = (crc << 2) ^ tab[0][crc >> 30];
313 crc = (crc << 2) ^ tab[0][crc >> 30];
317 crc ^= *p++ << 24;
318 crc = (crc << 4) ^ tab[0][crc >> 28];
319 crc = (crc << 4) ^ tab[0][crc >> 28];
323 crc ^= *p++ << 24;
324 crc = (crc << 8) ^ tab[0][crc >> 24];
327 crc = (__force u32) __cpu_to_be32(crc);
328 crc = crc32_body(crc, p, len, tab);
329 crc = __be32_to_cpu((__force __be32)crc);
331 return crc;
335 u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) argument
337 return crc32_be_generic(crc, p, len, NULL, CRC32_POLY_BE);
340 u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) argument
342 return crc32_be_generic(crc, p, len,