Lines Matching +full:32 +full:- +full:bits
1 // SPDX-License-Identifier: GPL-2.0-only
9 #include <asm/alternative-macros.h>
19 * Refer to https://www.corsix.org/content/barrett-reduction-polynomials for
23 * let "-" denotes polynomial sub (XOR)
28 * let "T" denotes 2^(XLEN+32)
32 * => S * (2^32) - S * (2^32) / P * P
33 * => lowest 32 bits of: S * (2^32) / P * P
34 * => lowest 32 bits of: S * (2^32) * (T / P) / T * P
35 * => lowest 32 bits of: S * (2^32) * quotient / T * P
36 * => lowest 32 bits of: S * quotient / 2^XLEN * P
37 * => lowest 32 bits of: (clmul_high_part(S, QT) + S) * P
45 /* Slide by XLEN bits per iteration */
50 /* Polynomial quotient of (2^(XLEN+32))/CRC32_POLY, in LE format */
53 /* Polynomial quotient of (2^(XLEN+32))/CRC32C_POLY, in LE format */
56 /* Polynomial quotient of (2^(XLEN+32))/CRC32_POLY, in BE format, it should be
57 * the same as the bit-reversed version of CRC32_POLY_QT_LE
77 "srli %0, %0, 32\n" in crc32_le_zbc()
82 "r" ((u64)poly << 32) in crc32_le_zbc()
89 return ((u64)crc << 32) ^ (__force u64)__cpu_to_be64(*ptr); in crc32_be_prep()
92 #elif __riscv_xlen == 32
152 #define OFFSET_MASK (STEP - 1)
160 size_t bits = len * 8; in crc32_le_unaligned() local
165 s = ((unsigned long)*p++ << (__riscv_xlen - 8)) | (s >> 8); in crc32_le_unaligned()
167 s ^= (unsigned long)crc << (__riscv_xlen - bits); in crc32_le_unaligned()
168 if (__riscv_xlen == 32 || len < sizeof(u32)) in crc32_le_unaligned()
169 crc_low = crc >> bits; in crc32_le_unaligned()
193 head_len = min(STEP - offset, len); in crc32_le_generic()
196 len -= head_len; in crc32_le_generic()
235 size_t bits = len * 8; in crc32_be_unaligned() local
243 if (__riscv_xlen == 32 || len < sizeof(u32)) { in crc32_be_unaligned()
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()
269 head_len = min(STEP - offset, len); in crc32_be()
272 len -= head_len; in crc32_be()