Lines Matching full:crc
61 static inline u64 crc32_le_prep(u32 crc, unsigned long const *ptr) in crc32_le_prep() argument
63 return (u64)crc ^ (__force u64)__cpu_to_le64(*ptr); in crc32_le_prep()
68 u32 crc; in crc32_le_zbc() local
79 : "=&r" (crc) in crc32_le_zbc()
84 return crc; in crc32_le_zbc()
87 static inline u64 crc32_be_prep(u32 crc, unsigned long const *ptr) in crc32_be_prep() argument
89 return ((u64)crc << 32) ^ (__force u64)__cpu_to_be64(*ptr); in crc32_be_prep()
99 static inline u32 crc32_le_prep(u32 crc, unsigned long const *ptr) in crc32_le_prep() argument
101 return crc ^ (__force u32)__cpu_to_le32(*ptr); in crc32_le_prep()
106 u32 crc; in crc32_le_zbc() local
116 : "=&r" (crc) in crc32_le_zbc()
121 return crc; in crc32_le_zbc()
124 static inline u32 crc32_be_prep(u32 crc, unsigned long const *ptr) in crc32_be_prep() argument
126 return crc ^ (__force u32)__cpu_to_be32(*ptr); in crc32_be_prep()
135 u32 crc; in crc32_be_zbc() local
143 : "=&r" (crc) in crc32_be_zbc()
148 return crc; in crc32_be_zbc()
154 typedef u32 (*fallback)(u32 crc, unsigned char const *p, size_t len);
156 static inline u32 crc32_le_unaligned(u32 crc, unsigned char const *p, in crc32_le_unaligned() argument
167 s ^= (unsigned long)crc << (__riscv_xlen - bits); in crc32_le_unaligned()
169 crc_low = crc >> bits; in crc32_le_unaligned()
171 crc = crc32_le_zbc(s, poly, poly_qt); in crc32_le_unaligned()
172 crc ^= crc_low; in crc32_le_unaligned()
174 return crc; in crc32_le_unaligned()
177 static inline u32 __pure crc32_le_generic(u32 crc, unsigned char const *p, in crc32_le_generic() argument
194 crc = crc32_le_unaligned(crc, p, head_len, poly, poly_qt); in crc32_le_generic()
204 s = crc32_le_prep(crc, p_ul); in crc32_le_generic()
205 crc = crc32_le_zbc(s, poly, poly_qt); in crc32_le_generic()
212 crc = crc32_le_unaligned(crc, p, tail_len, poly, poly_qt); in crc32_le_generic()
214 return crc; in crc32_le_generic()
217 return crc_fb(crc, p, len); in crc32_le_generic()
220 u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) in crc32_le() argument
222 return crc32_le_generic(crc, p, len, CRC32_POLY_LE, CRC32_POLY_QT_LE, in crc32_le()
226 u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) in __crc32c_le() argument
228 return crc32_le_generic(crc, p, len, CRC32C_POLY_LE, in __crc32c_le()
232 static inline u32 crc32_be_unaligned(u32 crc, unsigned char const *p, in crc32_be_unaligned() argument
244 s ^= crc >> (32 - bits); in crc32_be_unaligned()
245 crc_low = crc << bits; in crc32_be_unaligned()
247 s ^= (unsigned long)crc << (bits - 32); in crc32_be_unaligned()
250 crc = crc32_be_zbc(s); in crc32_be_unaligned()
251 crc ^= crc_low; in crc32_be_unaligned()
253 return crc; in crc32_be_unaligned()
256 u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) in crc32_be() argument
270 crc = crc32_be_unaligned(crc, p, head_len); in crc32_be()
280 s = crc32_be_prep(crc, p_ul); in crc32_be()
281 crc = crc32_be_zbc(s); in crc32_be()
288 crc = crc32_be_unaligned(crc, p, tail_len); in crc32_be()
290 return crc; in crc32_be()
293 return crc32_be_base(crc, p, len); in crc32_be()