#include <stdint.h>
#include <string.h>
Go to the source code of this file.
|
| uint32_t | crc32c_hw (uint32_t crc, const void *buf, size_t len) |
| |
| uint32_t | crc32c_sw (uint32_t crc, const void *buf, size_t len) |
| |
| uint32_t | crc32c (uint32_t crc, const void *buf, size_t len) |
| |
◆ crc32c()
| uint32_t crc32c |
( |
uint32_t |
crc, |
|
|
const void * |
buf, |
|
|
size_t |
len |
|
) |
| |
Definition at line 391 of file crc32c.cxx.
392{
393#ifdef HAVE_HWCRC32C
394 int sse42;
395
396 SSE42(sse42);
398#elif defined(__ARM_FEATURE_CRC32)
399 return crc32c_arm_hw(crc, buf, len);
400#else
401#warning Hardware accelerated CRC32C is not available.
403#endif
404}
uint32_t crc32c_sw(uint32_t crci, const void *buf, size_t len)
uint32_t crc32c_hw(uint32_t crc, const void *buf, size_t len)
◆ crc32c_hw()
| uint32_t crc32c_hw |
( |
uint32_t |
crc, |
|
|
const void * |
buf, |
|
|
size_t |
len |
|
) |
| |
◆ crc32c_sw()
| uint32_t crc32c_sw |
( |
uint32_t |
crc, |
|
|
const void * |
buf, |
|
|
size_t |
len |
|
) |
| |
Definition at line 99 of file crc32c.cxx.
100{
101 const unsigned char *next = (const unsigned char*)buf;
102 uint64_t crc;
103
105 crc = crci ^ 0xffffffff;
106 while (len && ((uintptr_t)next & 7) != 0) {
107 crc =
crc32c_table[0][(crc ^ *next++) & 0xff] ^ (crc >> 8);
108 len--;
109 }
110 while (len >= 8) {
111 crc ^= *(uint64_t *)next;
120 next += 8;
121 len -= 8;
122 }
123 while (len) {
124 crc =
crc32c_table[0][(crc ^ *next++) & 0xff] ^ (crc >> 8);
125 len--;
126 }
127 return (uint32_t)crc ^ 0xffffffff;
128}
static uint32_t crc32c_table[8][256]
static pthread_once_t crc32c_once_sw
static void crc32c_init_sw(void)