19 static uint32_t
crc_le_step(uint32_t poly, uint32_t crc, uint32_t data_in,
20 unsigned int data_bits)
22 for (
unsigned int i = 0; i < data_bits; i++) {
24 d = ((data_in >> i) & 0x1) ? 0xffffffff : 0;
25 c = (crc & 0x1) ? 0xffffffff : 0;
27 crc = crc ^ ((d ^ c) & poly);
33 uint32_t
crc32_le(uint32_t poly, uint32_t seed,
const void *_data,
36 if (((uintptr_t)_data & 0x3) || (data_len & 0x3)) {
38 const uint8_t *data = _data;
39 for (
size_t i = 0; i < data_len; i++)
44 const uint32_t *data = _data;
45 for (
size_t i = 0; i < data_len; i++)
static uint32_t crc_le_step(uint32_t poly, uint32_t crc, uint32_t data_in, unsigned int data_bits)
uint32_t crc32_le(uint32_t poly, uint32_t seed, const void *_data, size_t data_len)
Calculate the CRC32 value of the given data.
A generic CRC32 implementation.