2 #include "../include/generated/autoconf.h"
6 #define ENTRIES_PER_LINE 4
9 # define LE_TABLE_ROWS (CRC_LE_BITS/8)
10 # define LE_TABLE_SIZE 256
12 # define LE_TABLE_ROWS 1
13 # define LE_TABLE_SIZE (1 << CRC_LE_BITS)
17 # define BE_TABLE_ROWS (CRC_BE_BITS/8)
18 # define BE_TABLE_SIZE 256
20 # define BE_TABLE_ROWS 1
21 # define BE_TABLE_SIZE (1 << CRC_BE_BITS)
35 static void crc32init_le_generic(
const uint32_t polynomial,
44 crc = (crc >> 1) ^ ((crc & 1) ? polynomial : 0);
46 tab[0][i + j] = crc ^ tab[0][j];
51 crc = tab[0][crc & 0xff] ^ (crc >> 8);
57 static void crc32init_le(
void)
59 crc32init_le_generic(
CRCPOLY_LE, crc32table_le);
62 static void crc32cinit_le(
void)
70 static void crc32init_be(
void)
75 crc32table_be[0][0] = 0;
78 crc = (crc << 1) ^ ((crc & 0x80000000) ?
CRCPOLY_BE : 0);
79 for (j = 0; j <
i; j++)
80 crc32table_be[0][i + j] = crc ^ crc32table_be[0][j];
83 crc = crc32table_be[0][
i];
85 crc = crc32table_be[0][(crc >> 24) & 0xff] ^ (crc << 8);
86 crc32table_be[
j][
i] =
crc;
95 for (j = 0 ; j <
rows; j++) {
97 for (i = 0; i < len - 1; i++) {
102 printf(
"%s(0x%8.8xL)},\n", trans,
table[j][len - 1]);
108 printf(
"/* this file is generated - do not edit */\n\n");
112 printf(
"static u32 __cacheline_aligned "
113 "crc32table_le[%d][%d] = {",
122 printf(
"static u32 __cacheline_aligned "
123 "crc32table_be[%d][%d] = {",
126 BE_TABLE_SIZE,
"tobe");
131 printf(
"static u32 __cacheline_aligned "
132 "crc32ctable_le[%d][%d] = {",