Lines Matching +full:32 +full:- +full:bits
1 // SPDX-License-Identifier: GPL-2.0-only
9 #include <asm/alternative-macros.h>
20 * Refer to https://www.corsix.org/content/barrett-reduction-polynomials for
24 * let "-" denotes polynomial sub (XOR)
29 * let "T" denotes 2^(XLEN+32)
33 * => S * (2^32) - S * (2^32) / P * P
34 * => lowest 32 bits of: S * (2^32) / P * P
35 * => lowest 32 bits of: S * (2^32) * (T / P) / T * P
36 * => lowest 32 bits of: S * (2^32) * quotient / T * P
37 * => lowest 32 bits of: S * quotient / 2^XLEN * P
38 * => lowest 32 bits of: (clmul_high_part(S, QT) + S) * P
46 /* Slide by XLEN bits per iteration */
51 /* Polynomial quotient of (2^(XLEN+32))/CRC32_POLY, in LE format */
54 /* Polynomial quotient of (2^(XLEN+32))/CRC32C_POLY, in LE format */
57 /* Polynomial quotient of (2^(XLEN+32))/CRC32_POLY, in BE format, it should be
58 * the same as the bit-reversed version of CRC32_POLY_QT_LE
78 "srli %0, %0, 32\n" in crc32_le_zbc()
83 "r" ((u64)poly << 32) in crc32_le_zbc()
90 return ((u64)crc << 32) ^ (__force u64)__cpu_to_be64(*ptr); in crc32_be_prep()
93 #elif __riscv_xlen == 32
153 #define OFFSET_MASK (STEP - 1)
161 size_t bits = len * 8; in crc32_le_unaligned() local
166 s = ((unsigned long)*p++ << (__riscv_xlen - 8)) | (s >> 8); in crc32_le_unaligned()
168 s ^= (unsigned long)crc << (__riscv_xlen - bits); in crc32_le_unaligned()
169 if (__riscv_xlen == 32 || len < sizeof(u32)) in crc32_le_unaligned()
170 crc_low = crc >> bits; in crc32_le_unaligned()
194 head_len = min(STEP - offset, len); in crc32_le_generic()
197 len -= head_len; in crc32_le_generic()
238 size_t bits = len * 8; in crc32_be_unaligned() local
246 if (__riscv_xlen == 32 || len < sizeof(u32)) { in crc32_be_unaligned()
247 s ^= crc >> (32 - bits); in crc32_be_unaligned()
248 crc_low = crc << bits; in crc32_be_unaligned()
250 s ^= (unsigned long)crc << (bits - 32); in crc32_be_unaligned()
272 head_len = min(STEP - offset, len); in crc32_be_arch()
275 len -= head_len; in crc32_be_arch()