| 1 |
#ifndef CRC32_BRAID_P_H_ |
| 2 |
#define CRC32_BRAID_P_H_ |
| 3 |
|
| 4 |
#include "zbuild.h" |
| 5 |
#include "zendian.h" |
| 6 |
|
| 7 |
|
| 8 |
#ifdef Z_TESTN |
| 9 |
# define N Z_TESTN |
| 10 |
#else |
| 11 |
# define N 5 |
| 12 |
#endif |
| 13 |
#if N < 1 || N > 6 |
| 14 |
# error N must be in 1..6 |
| 15 |
#endif |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifdef Z_TESTW |
| 23 |
# if Z_TESTW-1 != -1 |
| 24 |
# define W Z_TESTW |
| 25 |
# endif |
| 26 |
#else |
| 27 |
# ifndef W |
| 28 |
# if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) |
| 29 |
# define W 8 |
| 30 |
# else |
| 31 |
# define W 4 |
| 32 |
# endif |
| 33 |
# endif |
| 34 |
#endif |
| 35 |
#ifdef W |
| 36 |
# if W == 8 |
| 37 |
typedef uint64_t z_word_t; |
| 38 |
# else |
| 39 |
# undef W |
| 40 |
# define W 4 |
| 41 |
typedef uint32_t z_word_t; |
| 42 |
# endif |
| 43 |
#endif |
| 44 |
|
| 45 |
|
| 46 |
#define POLY 0xedb88320 |
| 47 |
|
| 48 |
extern uint32_t crc32_braid(uint32_t crc, const uint8_t *buf, uint64_t len); |
| 49 |
|
| 50 |
#endif |