crc64_table.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: 0BSD
  2. ///////////////////////////////////////////////////////////////////////////////
  3. //
  4. /// \file crc64_table.c
  5. /// \brief Precalculated CRC64 table with correct endianness
  6. //
  7. // Author: Lasse Collin
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #include "common.h"
  11. // FIXME: Compared to crc_common.h this has to check for __x86_64__ too
  12. // so that in 32-bit builds crc64_x86.S won't break due to a missing table.
  13. #if defined(HAVE_USABLE_CLMUL) && ((defined(__x86_64__) && defined(__SSSE3__) \
  14. && defined(__SSE4_1__) && defined(__PCLMUL__)) \
  15. || (defined(__e2k__) && __iset__ >= 6))
  16. # define NO_CRC64_TABLE
  17. #endif
  18. #ifdef NO_CRC64_TABLE
  19. // No table needed. Use a typedef to avoid an empty translation unit.
  20. typedef void lzma_crc64_dummy;
  21. #else
  22. // Having the declaration here silences clang -Wmissing-variable-declarations.
  23. extern const uint64_t lzma_crc64_table[4][256];
  24. # if defined(WORDS_BIGENDIAN)
  25. # error #include "crc64_table_be.h"
  26. # else
  27. # include "crc64_table_le.h"
  28. # endif
  29. #endif