Lines Matching +full:4 +full:- +full:bits
1 // SPDX-License-Identifier: GPL-2.0-only
3 * crc4.c - simple crc-4 calculations.
15 * crc4 - calculate the 4-bit crc of a value.
18 * @bits: number of bits in @x to checksum
22 * The @x value is treated as left-aligned, and bits above @bits are ignored
25 uint8_t crc4(uint8_t c, uint64_t x, int bits) in crc4() argument
30 x &= (1ull << bits) - 1; in crc4()
32 /* Align to 4-bits */ in crc4()
33 bits = (bits + 3) & ~0x3; in crc4()
35 /* Calculate crc4 over four-bit nibbles, starting at the MSbit */ in crc4()
36 for (i = bits - 4; i >= 0; i -= 4) in crc4()