blob: 624e22ecd9e80fdd9b2faa4eec785a76afdee768 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#ifndef CRC32_BRAID_P_H_
#define CRC32_BRAID_P_H_
#include "zendian.h"
/* Define BRAID_N, valid range is 1..6 */
#define BRAID_N 5
/* Define BRAID_W and the associated z_word_t type. If BRAID_W is not defined, then a braided
calculation is not used, and the associated tables and code are not compiled.
TODO: According to crc32_braid_c.c, BRAID_N=5, BRAID_W=4 is fastest with Sparc64-VII,
PowerPC POWER9, and MIPS64 Octeon II processors.
*/
#ifdef ARCH_64BIT
# define BRAID_W 8
typedef uint64_t z_word_t;
# define Z_WORD_FROM_LE(word) Z_U64_FROM_LE(word)
#else
# define BRAID_W 4
typedef uint32_t z_word_t;
# define Z_WORD_FROM_LE(word) Z_U32_FROM_LE(word)
#endif
#if BYTE_ORDER == LITTLE_ENDIAN
# define BRAID_TABLE crc_braid_table
#elif BYTE_ORDER == BIG_ENDIAN
# define BRAID_TABLE crc_braid_big_table
#else
# error "No endian defined"
#endif
/* CRC polynomial. */
#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
#endif /* CRC32_BRAID_P_H_ */
|