| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
#ifndef LZMA_CRC_COMMON_H |
| 16 |
#define LZMA_CRC_COMMON_H |
| 17 |
|
| 18 |
#include "common.h" |
| 19 |
|
| 20 |
|
| 21 |
#ifdef WORDS_BIGENDIAN |
| 22 |
# define A(x) ((x) >> 24) |
| 23 |
# define B(x) (((x) >> 16) & 0xFF) |
| 24 |
# define C(x) (((x) >> 8) & 0xFF) |
| 25 |
# define D(x) ((x) & 0xFF) |
| 26 |
|
| 27 |
# define S8(x) ((x) << 8) |
| 28 |
# define S32(x) ((x) << 32) |
| 29 |
|
| 30 |
#else |
| 31 |
# define A(x) ((x) & 0xFF) |
| 32 |
# define B(x) (((x) >> 8) & 0xFF) |
| 33 |
# define C(x) (((x) >> 16) & 0xFF) |
| 34 |
# define D(x) ((x) >> 24) |
| 35 |
|
| 36 |
# define S8(x) ((x) >> 8) |
| 37 |
# define S32(x) ((x) >> 32) |
| 38 |
#endif |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#if lzma_has_attribute(__no_sanitize_address__) |
| 44 |
# define crc_attr_no_sanitize_address \ |
| 45 |
__attribute__((__no_sanitize_address__)) |
| 46 |
#else |
| 47 |
# define crc_attr_no_sanitize_address |
| 48 |
#endif |
| 49 |
|
| 50 |
|
| 51 |
#if defined(_WIN32) || defined(HAVE_GETAUXVAL) \ |
| 52 |
|| defined(HAVE_ELF_AUX_INFO) \ |
| 53 |
|| (defined(__APPLE__) && defined(HAVE_SYSCTLBYNAME)) |
| 54 |
# define ARM64_RUNTIME_DETECTION 1 |
| 55 |
#endif |
| 56 |
|
| 57 |
|
| 58 |
#undef CRC32_GENERIC |
| 59 |
#undef CRC64_GENERIC |
| 60 |
|
| 61 |
#undef CRC32_ARCH_OPTIMIZED |
| 62 |
#undef CRC64_ARCH_OPTIMIZED |
| 63 |
|
| 64 |
|
| 65 |
#undef CRC_X86_CLMUL |
| 66 |
|
| 67 |
#undef CRC32_ARM64 |
| 68 |
#undef CRC64_ARM64_CLMUL |
| 69 |
|
| 70 |
#undef CRC_USE_GENERIC_FOR_SMALL_INPUTS |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
#if defined(HAVE_ARM64_CRC32) && !defined(WORDS_BIGENDIAN) |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
# if defined(__ARM_FEATURE_CRC32) |
| 83 |
# define CRC32_ARCH_OPTIMIZED 1 |
| 84 |
# define CRC32_ARM64 1 |
| 85 |
# elif defined(ARM64_RUNTIME_DETECTION) |
| 86 |
# define CRC32_ARCH_OPTIMIZED 1 |
| 87 |
# define CRC32_ARM64 1 |
| 88 |
# define CRC32_GENERIC 1 |
| 89 |
# endif |
| 90 |
#endif |
| 91 |
|
| 92 |
#if defined(HAVE_USABLE_CLMUL) |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
# if (defined(__SSSE3__) && defined(__SSE4_1__) && defined(__PCLMUL__)) \ |
| 100 |
|| (defined(__e2k__) && __iset__ >= 6) |
| 101 |
# define CRC32_ARCH_OPTIMIZED 1 |
| 102 |
# define CRC64_ARCH_OPTIMIZED 1 |
| 103 |
# define CRC_X86_CLMUL 1 |
| 104 |
# else |
| 105 |
# define CRC32_GENERIC 1 |
| 106 |
# define CRC64_GENERIC 1 |
| 107 |
# define CRC32_ARCH_OPTIMIZED 1 |
| 108 |
# define CRC64_ARCH_OPTIMIZED 1 |
| 109 |
# define CRC_X86_CLMUL 1 |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
# endif |
| 123 |
#endif |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
#if !defined(CRC32_ARCH_OPTIMIZED) && !defined(CRC32_GENERIC) |
| 128 |
# define CRC32_GENERIC 1 |
| 129 |
#endif |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
#if !defined(CRC64_ARCH_OPTIMIZED) && !defined(CRC64_GENERIC) |
| 134 |
# define CRC64_GENERIC 1 |
| 135 |
#endif |
| 136 |
|
| 137 |
#endif |