53#if defined(__GNUC__) && defined(__x86_64__) || defined(_WIN32) 
   56#define CRC32_x86_64_WIN 
   58#define CRC32_x86_64_DEFAULT 
   60#elif defined(__aarch64__) && defined(__GNUC__) 
   63#define CRC32_ARM64_APPLE 
   65#define CRC32_ARM64_DEFAULT 
  122#include <nmmintrin.h> 
  123#include <wmmintrin.h> 
  126#ifdef CRC32_x86_64_WIN 
  135#ifdef CRC32_ARM64_DEFAULT 
  136#include <asm/hwcap.h> 
  140#ifdef CRC32_ARM64_APPLE 
  141#if __has_include(<asm/hwcap.h>) &&  __has_include(<sys/auxv.h>) 
  143    "Current implementation is based on assumption that APPLE_ARM always " \
 
  144    "supports crc32 and pmull and that there is no way to check it, yet it "\
 
  145    "seem that this APPLE_ARM has getauxval()."
 
  188MY_ATTRIBUTE((target(
"sse4.2")))
 
  189#elif defined(CRC32_ARM64_DEFAULT) 
  190MY_ATTRIBUTE((target(
"+crc")))
 
  192static inline uint64_t crc32_update_uint64(uint64_t crc, uint64_t data) {
 
  194  return _mm_crc32_u64(crc, data);
 
  195#elif defined(CRC32_ARM64) 
  196  return (uint64_t)__crc32cd((uint32_t)crc, data);
 
  203static inline uint64_t crc32_hash_uint64(uint64_t 
value) {
 
  205  value *= 0xb5eb6fbadd39bf9b;
 
  206  return (crc32_update_uint64(0, 
value) ^ 
value) << 32 |
 
  207         crc32_update_uint64(0, (
value >> 32 | 
value << 32));
 
Definition: buf0block_hint.cc:30
 
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
 
Version control for database, common definitions, and include files.
 
uint32_t(* ut_crc32_func_t)(const byte *ptr, size_t len)
Calculates CRC32.
Definition: ut0crc32.h:160
 
bool ut_crc32_cpu_enabled
Flag that tells whether the CPU supports CRC32 or not.
Definition: crc32.cc:103
 
uint32_t ut_crc32_legacy_big_endian(const byte *buf, size_t len)
Calculates CRC32 using legacy algorithm, which uses big-endian byte ordering when converting byte seq...
Definition: crc32.cc:287
 
ut_crc32_func_t ut_crc32
Pointer to standard-compliant CRC32-C (using the GF(2) primitive polynomial 0x11EDC6F41) calculation ...
Definition: crc32.cc:101
 
void ut_crc32_init()
Initializes the data structures used by ut_crc32*().
Definition: crc32.cc:786
 
bool ut_poly_mul_cpu_enabled
Flag that tells whether the CPU supports polynomial multiplication or not.
Definition: crc32.cc:104
 
constexpr uint32_t CRC32C_POLYNOMIAL
The CRC-32C polynomial without the implicit highest 1 at x^32.
Definition: ut0crc32.h:154
 
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105