1 // SPDX-License-Identifier: 0BSD 2 3 /////////////////////////////////////////////////////////////////////////////// 4 // 5 /// \file crc32_table.c 6 /// \brief Precalculated CRC32 table with correct endianness 7 // 8 // Author: Lasse Collin 9 // 10 /////////////////////////////////////////////////////////////////////////////// 11 12 #include "common.h" 13 14 15 // FIXME: Compared to crc_common.h this has to check for __x86_64__ too 16 // so that in 32-bit builds crc32_x86.S won't break due to a missing table. 17 #if defined(HAVE_USABLE_CLMUL) && ((defined(__x86_64__) && defined(__SSSE3__) \ 18 && defined(__SSE4_1__) && defined(__PCLMUL__)) \ 19 || (defined(__e2k__) && __iset__ >= 6)) 20 # define X86_CLMUL_NO_TABLE 1 21 #endif 22 23 #if defined(HAVE_ARM64_CRC32) \ 24 && !defined(WORDS_BIGENDIAN) \ 25 && defined(__ARM_FEATURE_CRC32) 26 # define ARM64_CRC32_NO_TABLE 1 27 #endif 28 29 30 #if !defined(HAVE_ENCODERS) && (defined(X86_CLMUL_NO_TABLE) \ 31 || defined(ARM64_CRC32_NO_TABLE_)) 32 // No table needed. Use a typedef to avoid an empty translation unit. 33 typedef void lzma_crc32_dummy; 34 35 #else 36 // Having the declaration here silences clang -Wmissing-variable-declarations. 37 extern const uint32_t lzma_crc32_table[8][256]; 38 39 # ifdef WORDS_BIGENDIAN 40 # include "crc32_table_be.h" 41 # else 42 # include "crc32_table_le.h" 43 # endif 44 #endif 45