4 int main(int argc
, char *argv
[])
6 /* Polynomial in bit-reversed notation */
8 uint64_t crctab
[256], v
;
11 poly
= strtoumax(argv
[1], NULL
, 0);
14 printf("static const uint64_t crc64_tab[256] = {\n");
15 for (i
= 0; i
< 256; i
++) {
17 for (j
= 0; j
< 8; j
++)
18 v
= (v
>> 1) ^ ((v
& 1) ? poly
: 0);
22 for (i
= 0; i
< 256; i
+= 2) {
23 printf(" /* %02x */ UINT64_C(0x%016"PRIx64
"), "
24 "UINT64_C(0x%016"PRIx64
")%s\n",
25 i
, crctab
[i
], crctab
[i
+1], (i
== 254) ? "" : ",");
30 printf("@crc64_tab = (\n");
31 for (i
= 0; i
< 256; i
+= 2) {
32 printf(" [0x%08"PRIx32
", 0x%08"PRIx32
"], "
33 "[0x%08"PRIx32
", 0x%08"PRIx32
"]%-1s # %02x\n",
34 (uint32_t)(crctab
[i
] >> 32),
35 (uint32_t)(crctab
[i
]),
36 (uint32_t)(crctab
[i
+1] >> 32),
37 (uint32_t)(crctab
[i
+1]),
38 (i
== 254) ? "" : ",",