1 ///////////////////////////////////////////////////////////////////////////////
3 /// \file crc32_tablegen.c
4 /// \brief Generates CRC32 crc32_table.c
6 /// Compiling: gcc -std=c99 -o crc32_tablegen crc32_tablegen.c crc32_init.c
7 /// Add -DWORDS_BIGENDIAN to generate big endian table.
9 // This code has been put into the public domain.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 ///////////////////////////////////////////////////////////////////////////////
17 #include <sys/types.h>
22 extern void lzma_crc32_init(void);
24 extern uint32_t lzma_crc32_table[8][256];
32 printf("/* This file has been automatically generated by "
33 "crc32_tablegen.c. */\n\n"
34 "const uint32_t lzma_crc32_table[8][256] = {\n\t{");
36 for (size_t s = 0; s < 8; ++s) {
37 for (size_t b = 0; b < 256; ++b) {
41 printf("0x%08" PRIX32, lzma_crc32_table[s][b]);
48 printf("\n\t}\n};\n");