43 #ifndef XXH3_H_1397135465 44 #define XXH3_H_1397135465 47 #ifndef XXHASH_H_5627135585666179 49 # undef XXH_INLINE_ALL 50 # define XXH_INLINE_ALL 57 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 58 # define XXH_RESTRICT restrict 64 #if (defined(__GNUC__) && (__GNUC__ >= 3)) \ 65 || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) \ 67 # define XXH_likely(x) __builtin_expect(x, 1) 68 # define XXH_unlikely(x) __builtin_expect(x, 0) 70 # define XXH_likely(x) (x) 71 # define XXH_unlikely(x) (x) 75 # if defined(__AVX2__) 76 # include <immintrin.h> 77 # elif defined(__SSE2__) 78 # include <emmintrin.h> 79 # elif defined(__ARM_NEON__) || defined(__ARM_NEON) 80 # define inline __inline__ 81 # include <arm_neon.h> 84 #elif defined(_MSC_VER) 154 #if defined(__thumb__) && !defined(__thumb2__) && defined(__ARM_ARCH_ISA_ARM) 155 # warning "XXH3 is highly inefficient without ARM or Thumb-2." 168 # if defined(__AVX2__) 169 # define XXH_VECTOR XXH_AVX2 170 # elif defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2)) 171 # define XXH_VECTOR XXH_SSE2 172 # elif defined(__GNUC__) \ 173 && (defined(__ARM_NEON__) || defined(__ARM_NEON)) \ 174 && (defined(__LITTLE_ENDIAN__) \ 175 || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) 176 # define XXH_VECTOR XXH_NEON 177 # elif (defined(__PPC64__) && defined(__POWER8_VECTOR__)) \ 178 || (defined(__s390x__) && defined(__VEC__)) \ 180 # define XXH_VECTOR XXH_VSX 182 # define XXH_VECTOR XXH_SCALAR 190 #ifndef XXH_ACC_ALIGN 191 # if XXH_VECTOR == XXH_SCALAR 192 # define XXH_ACC_ALIGN 8 193 # elif XXH_VECTOR == XXH_SSE2 194 # define XXH_ACC_ALIGN 16 195 # elif XXH_VECTOR == XXH_AVX2 196 # define XXH_ACC_ALIGN 32 197 # elif XXH_VECTOR == XXH_NEON 198 # define XXH_ACC_ALIGN 16 199 # elif XXH_VECTOR == XXH_VSX 200 # define XXH_ACC_ALIGN 16 225 #if XXH_VECTOR == XXH_AVX2 \ 226 && defined(__GNUC__) && !defined(__clang__) \ 227 && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) 228 # pragma GCC push_options 229 # pragma GCC optimize("-O2") 233 #if XXH_VECTOR == XXH_NEON 314 # if !defined(XXH_NO_VZIP_HACK) \ 315 && defined(__GNUC__) \ 316 && !defined(__aarch64__) && !defined(__arm64__) 317 # define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ 322 __asm__("vzip.32 %e0, %f0" : "+w" (in)); \ 323 (outLo) = vget_low_u32 (vreinterpretq_u32_u64(in)); \ 324 (outHi) = vget_high_u32(vreinterpretq_u32_u64(in)); \ 327 # define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ 329 (outLo) = vmovn_u64 (in); \ 330 (outHi) = vshrn_n_u64 ((in), 32); \ 343 #if XXH_VECTOR == XXH_VSX 344 # if defined(__s390x__) 345 # include <s390intrin.h> 347 # include <altivec.h> 352 typedef __vector
unsigned long long xxh_u64x2;
353 typedef __vector
unsigned char xxh_u8x16;
354 typedef __vector
unsigned xxh_u32x4;
357 # if defined(__BIG_ENDIAN__) \ 358 || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 359 # define XXH_VSX_BE 1 360 # elif defined(__VEC_ELEMENT_REG_ORDER__) && __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__ 361 # warning "-maltivec=be is not recommended. Please use native endianness." 362 # define XXH_VSX_BE 1 364 # define XXH_VSX_BE 0 370 # if defined(__POWER9_VECTOR__) || (defined(__clang__) && defined(__s390x__)) 371 # define XXH_vec_revb vec_revb 373 XXH_FORCE_INLINE xxh_u64x2 XXH_vec_revb(xxh_u64x2 val)
375 xxh_u8x16
const vByteSwap = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
376 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 };
377 return vec_perm(val, val, vByteSwap);
385 XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(
const void *ptr)
388 memcpy(&ret, ptr,
sizeof(xxh_u64x2));
390 ret = XXH_vec_revb(ret);
401 # if defined(__s390x__) 403 # define XXH_vec_mulo vec_mulo 404 # define XXH_vec_mule vec_mule 405 # elif defined(__clang__) && __has_builtin(__builtin_altivec_vmuleuw) 407 # define XXH_vec_mulo __builtin_altivec_vmulouw 408 # define XXH_vec_mule __builtin_altivec_vmuleuw 412 XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mulo(xxh_u32x4 a, xxh_u32x4 b)
415 __asm__(
"vmulouw %0, %1, %2" :
"=v" (result) :
"v" (a),
"v" (b));
418 XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b)
421 __asm__(
"vmuleuw %0, %1, %2" :
"=v" (result) :
"v" (a),
"v" (b));
430 #if defined(XXH_NO_PREFETCH) 431 # define XXH_PREFETCH(ptr) (void)(ptr) 433 # if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) 434 # include <mmintrin.h> 435 # define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) 436 # elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) 437 # define XXH_PREFETCH(ptr) __builtin_prefetch((ptr), 0 , 3 ) 439 # define XXH_PREFETCH(ptr) (void)(ptr) 448 #define XXH_SECRET_DEFAULT_SIZE 192 450 #if (XXH_SECRET_DEFAULT_SIZE < XXH3_SECRET_SIZE_MIN) 451 # error "default keyset is not large enough" 456 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c,
457 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f,
458 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21,
459 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c,
460 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3,
461 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8,
462 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d,
463 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64,
465 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb,
466 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e,
467 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce,
468 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e,
487 #if defined(_MSC_VER) && defined(_M_IX86) 489 # define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y)) 498 # define XXH_mult32to64(x, y) ((xxh_u64)(xxh_u32)(x) * (xxh_u64)(xxh_u32)(y)) 524 #if defined(__GNUC__) && !defined(__wasm__) \ 525 && defined(__SIZEOF_INT128__) \ 526 || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) 528 __uint128_t product = (__uint128_t)lhs * (__uint128_t)rhs;
529 XXH128_hash_t
const r128 = { (xxh_u64)(product), (xxh_u64)(product >> 64) };
539 #elif defined(_M_X64) || defined(_M_IA64) 542 # pragma intrinsic(_umul128) 544 xxh_u64 product_high;
545 xxh_u64
const product_low = _umul128(lhs, rhs, &product_high);
546 XXH128_hash_t
const r128 = { product_low, product_high };
594 xxh_u64
const lo_lo =
XXH_mult32to64(lhs & 0xFFFFFFFF, rhs & 0xFFFFFFFF);
595 xxh_u64
const hi_lo =
XXH_mult32to64(lhs >> 32, rhs & 0xFFFFFFFF);
596 xxh_u64
const lo_hi =
XXH_mult32to64(lhs & 0xFFFFFFFF, rhs >> 32);
600 xxh_u64
const cross = (lo_lo >> 32) + (hi_lo & 0xFFFFFFFF) + lo_hi;
601 xxh_u64
const upper = (hi_lo >> 32) + (cross >> 32) + hi_hi;
602 xxh_u64
const lower = (cross << 32) | (lo_lo & 0xFFFFFFFF);
604 XXH128_hash_t r128 = { lower, upper };
619 return product.low64 ^ product.high64;
625 XXH_ASSERT(0 <= shift && shift < 64);
626 return v64 ^ (v64 >> shift);
637 h64 *= 0x165667919E3779F9ULL;
679 XXH_ASSERT(input != NULL);
680 XXH_ASSERT(1 <= len && len <= 3);
681 XXH_ASSERT(secret != NULL);
687 { xxh_u8
const c1 = input[0];
688 xxh_u8
const c2 = input[len >> 1];
689 xxh_u8
const c3 = input[len - 1];
690 xxh_u32
const combined = ((xxh_u32)c1<<16) | (((xxh_u32)c2) << 24) | (((xxh_u32)c3) << 0) | (((xxh_u32)len) << 8);
691 xxh_u64
const bitflip = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed;
692 xxh_u64
const keyed = (xxh_u64)combined ^ bitflip;
693 xxh_u64
const mixed = keyed * PRIME64_1;
701 XXH_ASSERT(input != NULL);
702 XXH_ASSERT(secret != NULL);
703 XXH_ASSERT(4 <= len && len < 8);
704 seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32;
705 { xxh_u32
const input1 = XXH_readLE32(input);
706 xxh_u32
const input2 = XXH_readLE32(input + len - 4);
707 xxh_u64
const bitflip = (XXH_readLE64(secret+8) ^ XXH_readLE64(secret+16)) - seed;
708 xxh_u64
const input64 = input2 + (((xxh_u64)input1) << 32);
709 xxh_u64 x = input64 ^ bitflip;
711 x ^= XXH_rotl64(x, 49) ^ XXH_rotl64(x, 24);
712 x *= 0x9FB21C651E98DF25ULL;
713 x ^= (x >> 35) + len ;
714 x *= 0x9FB21C651E98DF25ULL;
722 XXH_ASSERT(input != NULL);
723 XXH_ASSERT(secret != NULL);
724 XXH_ASSERT(8 <= len && len <= 16);
725 { xxh_u64
const bitflip1 = (XXH_readLE64(secret+24) ^ XXH_readLE64(secret+32)) + seed;
726 xxh_u64
const bitflip2 = (XXH_readLE64(secret+40) ^ XXH_readLE64(secret+48)) - seed;
727 xxh_u64
const input_lo = XXH_readLE64(input) ^ bitflip1;
728 xxh_u64
const input_hi = XXH_readLE64(input + len - 8) ^ bitflip2;
729 xxh_u64
const acc = len
730 + XXH_swap64(input_lo) + input_hi
739 XXH_ASSERT(len <= 16);
743 return XXH3_avalanche((PRIME64_1 + seed) ^ (XXH_readLE64(secret+56) ^ XXH_readLE64(secret+64)));
776 #if defined(__GNUC__) && !defined(__clang__) \ 777 && defined(__i386__) && defined(__SSE2__) \ 778 && !defined(XXH_ENABLE_AUTOVECTORIZE) 794 __asm__ (
"" :
"+r" (seed64));
796 { xxh_u64
const input_lo = XXH_readLE64(input);
797 xxh_u64
const input_hi = XXH_readLE64(input+8);
799 input_lo ^ (XXH_readLE64(secret) + seed64),
800 input_hi ^ (XXH_readLE64(secret+8) - seed64)
811 XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize;
812 XXH_ASSERT(16 < len && len <= 128);
814 { xxh_u64 acc = len * PRIME64_1;
819 acc +=
XXH3_mix16B(input+len-64, secret+112, seed);
834 #define XXH3_MIDSIZE_MAX 240 841 XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize;
844 #define XXH3_MIDSIZE_STARTOFFSET 3 845 #define XXH3_MIDSIZE_LASTOFFSET 17 847 { xxh_u64 acc = len * PRIME64_1;
848 int const nbRounds = (int)len / 16;
850 for (i=0; i<8; i++) {
851 acc +=
XXH3_mix16B(input+(16*i), secret+(16*i), seed);
854 XXH_ASSERT(nbRounds >= 8);
855 #if defined(__clang__) \ 856 && (defined(__ARM_NEON) || defined(__ARM_NEON__)) \ 857 && !defined(XXH_ENABLE_AUTOVECTORIZE) 878 #pragma clang loop vectorize(disable) 880 for (i=8 ; i < nbRounds; i++) {
892 #define STRIPE_LEN 64 893 #define XXH_SECRET_CONSUME_RATE 8 894 #define ACC_NB (STRIPE_LEN / sizeof(xxh_u64)) 920 XXH_FORCE_INLINE
void 926 #if (XXH_VECTOR == XXH_AVX2) 928 XXH_ASSERT((((
size_t)acc) & 31) == 0);
929 {
XXH_ALIGN(32) __m256i*
const xacc = (__m256i *) acc;
932 const __m256i*
const xinput = (
const __m256i *) input;
935 const __m256i*
const xsecret = (
const __m256i *) secret;
938 for (i=0; i <
STRIPE_LEN/
sizeof(__m256i); i++) {
940 __m256i
const data_vec = _mm256_loadu_si256 (xinput+i);
942 __m256i
const key_vec = _mm256_loadu_si256 (xsecret+i);
944 __m256i
const data_key = _mm256_xor_si256 (data_vec, key_vec);
946 __m256i
const data_key_lo = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1));
948 __m256i
const product = _mm256_mul_epu32 (data_key, data_key_lo);
951 __m256i
const data_swap = _mm256_shuffle_epi32(data_vec, _MM_SHUFFLE(1, 0, 3, 2));
952 __m256i
const sum = _mm256_add_epi64(xacc[i], data_swap);
954 xacc[i] = _mm256_add_epi64(product, sum);
957 __m256i
const sum = _mm256_add_epi64(xacc[i], data_vec);
959 xacc[i] = _mm256_add_epi64(product, sum);
963 #elif (XXH_VECTOR == XXH_SSE2) 966 XXH_ASSERT((((
size_t)acc) & 15) == 0);
967 {
XXH_ALIGN(16) __m128i*
const xacc = (__m128i *) acc;
970 const __m128i*
const xinput = (
const __m128i *) input;
973 const __m128i*
const xsecret = (
const __m128i *) secret;
976 for (i=0; i <
STRIPE_LEN/
sizeof(__m128i); i++) {
978 __m128i
const data_vec = _mm_loadu_si128 (xinput+i);
980 __m128i
const key_vec = _mm_loadu_si128 (xsecret+i);
982 __m128i
const data_key = _mm_xor_si128 (data_vec, key_vec);
984 __m128i
const data_key_lo = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1));
986 __m128i
const product = _mm_mul_epu32 (data_key, data_key_lo);
989 __m128i
const data_swap = _mm_shuffle_epi32(data_vec, _MM_SHUFFLE(1,0,3,2));
990 __m128i
const sum = _mm_add_epi64(xacc[i], data_swap);
992 xacc[i] = _mm_add_epi64(product, sum);
995 __m128i
const sum = _mm_add_epi64(xacc[i], data_vec);
997 xacc[i] = _mm_add_epi64(product, sum);
1001 #elif (XXH_VECTOR == XXH_NEON) 1003 XXH_ASSERT((((
size_t)acc) & 15) == 0);
1005 XXH_ALIGN(16) uint64x2_t*
const xacc = (uint64x2_t *) acc;
1007 uint8_t
const*
const xinput = (
const uint8_t *) input;
1008 uint8_t
const*
const xsecret = (
const uint8_t *) secret;
1011 for (i=0; i <
STRIPE_LEN /
sizeof(uint64x2_t); i++) {
1013 uint8x16_t data_vec = vld1q_u8(xinput + (i * 16));
1015 uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16));
1017 uint64x2_t data_key = vreinterpretq_u64_u8(veorq_u8(data_vec, key_vec));
1018 uint32x2_t data_key_lo, data_key_hi;
1021 xacc[i] = vaddq_u64 (xacc[i], vreinterpretq_u64_u8(data_vec));
1024 uint64x2_t
const data64 = vreinterpretq_u64_u8(data_vec);
1025 uint64x2_t
const swapped = vextq_u64(data64, data64, 1);
1026 xacc[i] = vaddq_u64 (xacc[i], swapped);
1031 XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi);
1033 xacc[i] = vmlal_u32 (xacc[i], data_key_lo, data_key_hi);
1038 #elif (XXH_VECTOR == XXH_VSX) 1039 xxh_u64x2*
const xacc = (xxh_u64x2*) acc;
1040 xxh_u64x2
const*
const xinput = (xxh_u64x2
const*) input;
1041 xxh_u64x2
const*
const xsecret = (xxh_u64x2
const*) secret;
1042 xxh_u64x2
const v32 = { 32, 32 };
1044 for (i = 0; i <
STRIPE_LEN /
sizeof(xxh_u64x2); i++) {
1046 xxh_u64x2
const data_vec = XXH_vec_loadu(xinput + i);
1048 xxh_u64x2
const key_vec = XXH_vec_loadu(xsecret + i);
1049 xxh_u64x2
const data_key = data_vec ^ key_vec;
1051 xxh_u32x4
const shuffled = (xxh_u32x4)vec_rl(data_key, v32);
1053 xxh_u64x2
const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled);
1057 xacc[i] += data_vec;
1061 xxh_u64x2
const data_swapped = vec_permi(data_vec, data_vec, 2);
1063 xxh_u64x2
const data_swapped = vec_xxpermdi(data_vec, data_vec, 2);
1065 xacc[i] += data_swapped;
1071 XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64*
const xacc = (xxh_u64*) acc;
1072 const xxh_u8*
const xinput = (
const xxh_u8*) input;
1073 const xxh_u8*
const xsecret = (
const xxh_u8*) secret;
1075 XXH_ASSERT(((
size_t)acc & (XXH_ACC_ALIGN-1)) == 0);
1076 for (i=0; i <
ACC_NB; i++) {
1077 xxh_u64
const data_val = XXH_readLE64(xinput + 8*i);
1078 xxh_u64
const data_key = data_val ^ XXH_readLE64(xsecret + i*8);
1081 xacc[i] += data_val;
1083 xacc[i ^ 1] += data_val;
1085 xacc[i] +=
XXH_mult32to64(data_key & 0xFFFFFFFF, data_key >> 32);
1110 XXH_FORCE_INLINE
void 1113 #if (XXH_VECTOR == XXH_AVX2) 1115 XXH_ASSERT((((
size_t)acc) & 31) == 0);
1116 {
XXH_ALIGN(32) __m256i*
const xacc = (__m256i*) acc;
1119 const __m256i*
const xsecret = (
const __m256i *) secret;
1120 const __m256i prime32 = _mm256_set1_epi32((
int)PRIME32_1);
1123 for (i=0; i <
STRIPE_LEN/
sizeof(__m256i); i++) {
1125 __m256i
const acc_vec = xacc[i];
1126 __m256i
const shifted = _mm256_srli_epi64 (acc_vec, 47);
1127 __m256i
const data_vec = _mm256_xor_si256 (acc_vec, shifted);
1129 __m256i
const key_vec = _mm256_loadu_si256 (xsecret+i);
1130 __m256i
const data_key = _mm256_xor_si256 (data_vec, key_vec);
1133 __m256i
const data_key_hi = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1));
1134 __m256i
const prod_lo = _mm256_mul_epu32 (data_key, prime32);
1135 __m256i
const prod_hi = _mm256_mul_epu32 (data_key_hi, prime32);
1136 xacc[i] = _mm256_add_epi64(prod_lo, _mm256_slli_epi64(prod_hi, 32));
1140 #elif (XXH_VECTOR == XXH_SSE2) 1142 XXH_ASSERT((((
size_t)acc) & 15) == 0);
1143 {
XXH_ALIGN(16) __m128i*
const xacc = (__m128i*) acc;
1146 const __m128i*
const xsecret = (
const __m128i *) secret;
1147 const __m128i prime32 = _mm_set1_epi32((
int)PRIME32_1);
1150 for (i=0; i <
STRIPE_LEN/
sizeof(__m128i); i++) {
1152 __m128i
const acc_vec = xacc[i];
1153 __m128i
const shifted = _mm_srli_epi64 (acc_vec, 47);
1154 __m128i
const data_vec = _mm_xor_si128 (acc_vec, shifted);
1156 __m128i
const key_vec = _mm_loadu_si128 (xsecret+i);
1157 __m128i
const data_key = _mm_xor_si128 (data_vec, key_vec);
1160 __m128i
const data_key_hi = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1));
1161 __m128i
const prod_lo = _mm_mul_epu32 (data_key, prime32);
1162 __m128i
const prod_hi = _mm_mul_epu32 (data_key_hi, prime32);
1163 xacc[i] = _mm_add_epi64(prod_lo, _mm_slli_epi64(prod_hi, 32));
1167 #elif (XXH_VECTOR == XXH_NEON) 1169 XXH_ASSERT((((
size_t)acc) & 15) == 0);
1171 { uint64x2_t* xacc = (uint64x2_t*) acc;
1172 uint8_t
const* xsecret = (uint8_t
const*) secret;
1173 uint32x2_t prime = vdup_n_u32 (PRIME32_1);
1176 for (i=0; i <
STRIPE_LEN/
sizeof(uint64x2_t); i++) {
1178 uint64x2_t acc_vec = xacc[i];
1179 uint64x2_t shifted = vshrq_n_u64 (acc_vec, 47);
1180 uint64x2_t data_vec = veorq_u64 (acc_vec, shifted);
1183 uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16));
1184 uint64x2_t data_key = veorq_u64(data_vec, vreinterpretq_u64_u8(key_vec));
1187 uint32x2_t data_key_lo, data_key_hi;
1191 XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi);
1210 uint64x2_t prod_hi = vmull_u32 (data_key_hi, prime);
1212 xacc[i] = vshlq_n_u64(prod_hi, 32);
1214 xacc[i] = vmlal_u32(xacc[i], data_key_lo, prime);
1218 #elif (XXH_VECTOR == XXH_VSX) 1220 XXH_ASSERT((((
size_t)acc) & 15) == 0);
1222 { xxh_u64x2*
const xacc = (xxh_u64x2*) acc;
1223 const xxh_u64x2*
const xsecret = (
const xxh_u64x2*) secret;
1225 xxh_u64x2
const v32 = { 32, 32 };
1226 xxh_u64x2
const v47 = { 47, 47 };
1227 xxh_u32x4
const prime = { PRIME32_1, PRIME32_1, PRIME32_1, PRIME32_1 };
1229 for (i = 0; i <
STRIPE_LEN /
sizeof(xxh_u64x2); i++) {
1231 xxh_u64x2
const acc_vec = xacc[i];
1232 xxh_u64x2
const data_vec = acc_vec ^ (acc_vec >> v47);
1235 xxh_u64x2
const key_vec = XXH_vec_loadu(xsecret + i);
1236 xxh_u64x2
const data_key = data_vec ^ key_vec;
1240 xxh_u64x2
const prod_even = XXH_vec_mule((xxh_u32x4)data_key, prime);
1242 xxh_u64x2
const prod_odd = XXH_vec_mulo((xxh_u32x4)data_key, prime);
1243 xacc[i] = prod_odd + (prod_even << v32);
1248 XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64*
const xacc = (xxh_u64*) acc;
1249 const xxh_u8*
const xsecret = (
const xxh_u8*) secret;
1251 XXH_ASSERT((((
size_t)acc) & (XXH_ACC_ALIGN-1)) == 0);
1252 for (i=0; i <
ACC_NB; i++) {
1253 xxh_u64
const key64 = XXH_readLE64(xsecret + 8*i);
1254 xxh_u64 acc64 = xacc[i];
1264 #define XXH_PREFETCH_DIST 384 1271 XXH_FORCE_INLINE
void 1279 for (n = 0; n < nbStripes; n++ ) {
1280 const xxh_u8*
const in = input + n*
STRIPE_LEN;
1289 XXH_FORCE_INLINE
void 1296 size_t const block_len =
STRIPE_LEN * nb_rounds;
1297 size_t const nb_blocks = len / block_len;
1301 XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN);
1303 for (n = 0; n < nb_blocks; n++) {
1304 XXH3_accumulate(acc, input + n*block_len, secret, nb_rounds, accWidth);
1310 {
size_t const nbStripes = (len - (block_len * nb_blocks)) /
STRIPE_LEN;
1312 XXH3_accumulate(acc, input + nb_blocks*block_len, secret, nbStripes, accWidth);
1316 const xxh_u8*
const p = input + len -
STRIPE_LEN;
1318 #define XXH_SECRET_LASTACC_START 7 1323 XXH_FORCE_INLINE xxh_u64
1327 acc[0] ^ XXH_readLE64(secret),
1328 acc[1] ^ XXH_readLE64(secret+8) );
1334 xxh_u64 result64 = start;
1344 #define XXH3_INIT_ACC { PRIME32_3, PRIME64_1, PRIME64_2, PRIME64_3, \ 1345 PRIME64_4, PRIME32_2, PRIME64_5, PRIME32_1 }; 1356 XXH_STATIC_ASSERT(
sizeof(acc) == 64);
1358 #define XXH_SECRET_MERGEACCS_START 11 1387 if (!XXH_CPU_LITTLE_ENDIAN) v64 = XXH_swap64(v64);
1388 memcpy(dst, &v64,
sizeof(v64));
1401 for (i=0; i < nbRounds; i++) {
1402 XXH_writeLE64(customSecret + 16*i, XXH_readLE64(kSecret + 16*i) + seed64);
1403 XXH_writeLE64(customSecret + 16*i + 8, XXH_readLE64(kSecret + 16*i + 8) - seed64);
1433 if (len <= 128)
return XXH3_len_17to128_64b((
const xxh_u8*)input, len, kSecret,
sizeof(kSecret), 0);
1441 XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN);
1448 if (len <= 16)
return XXH3_len_0to16_64b((
const xxh_u8*)input, len, (
const xxh_u8*)secret, 0);
1449 if (len <= 128)
return XXH3_len_17to128_64b((
const xxh_u8*)input, len, (
const xxh_u8*)secret, secretSize, 0);
1458 if (len <= 128)
return XXH3_len_17to128_64b((
const xxh_u8*)input, len, kSecret,
sizeof(kSecret), seed);
1467 return (XXH3_state_t*)XXH_malloc(
sizeof(XXH3_state_t));
1479 memcpy(dst_state, src_state,
sizeof(*dst_state));
1485 const xxh_u8* secret,
size_t secretSize)
1487 XXH_ASSERT(statePtr != NULL);
1488 memset(statePtr, 0,
sizeof(*statePtr));
1489 statePtr->acc[0] = PRIME32_3;
1490 statePtr->acc[1] = PRIME64_1;
1491 statePtr->acc[2] = PRIME64_2;
1492 statePtr->acc[3] = PRIME64_3;
1493 statePtr->acc[4] = PRIME64_4;
1494 statePtr->acc[5] = PRIME32_2;
1495 statePtr->acc[6] = PRIME64_5;
1496 statePtr->acc[7] = PRIME32_1;
1497 statePtr->seed = seed;
1498 XXH_ASSERT(secret != NULL);
1499 statePtr->secret = secret;
1500 XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN);
1501 statePtr->secretLimit = (XXH32_hash_t)(secretSize -
STRIPE_LEN);
1519 if (secretSize < XXH3_SECRET_SIZE_MIN)
return XXH_ERROR;
1529 statePtr->secret = statePtr->customSecret;
1533 XXH_FORCE_INLINE
void 1535 XXH32_hash_t* nbStripesSoFarPtr, XXH32_hash_t nbStripesPerBlock,
1536 const xxh_u8* input,
size_t totalStripes,
1537 const xxh_u8* secret,
size_t secretLimit,
1540 XXH_ASSERT(*nbStripesSoFarPtr < nbStripesPerBlock);
1541 if (nbStripesPerBlock - *nbStripesSoFarPtr <= totalStripes) {
1543 size_t const nbStripes = nbStripesPerBlock - *nbStripesSoFarPtr;
1547 *nbStripesSoFarPtr = (XXH32_hash_t)(totalStripes - nbStripes);
1550 *nbStripesSoFarPtr += (XXH32_hash_t)totalStripes;
1561 #if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1) 1567 {
const xxh_u8*
const bEnd = input + len;
1569 state->totalLen += len;
1571 if (state->bufferedSize + len <= XXH3_INTERNALBUFFER_SIZE) {
1572 XXH_memcpy(state->buffer + state->bufferedSize, input, len);
1573 state->bufferedSize += (XXH32_hash_t)len;
1578 #define XXH3_INTERNALBUFFER_STRIPES (XXH3_INTERNALBUFFER_SIZE / STRIPE_LEN) 1579 XXH_STATIC_ASSERT(XXH3_INTERNALBUFFER_SIZE %
STRIPE_LEN == 0);
1585 if (state->bufferedSize) {
1586 size_t const loadSize = XXH3_INTERNALBUFFER_SIZE - state->bufferedSize;
1587 XXH_memcpy(state->buffer + state->bufferedSize, input, loadSize);
1590 &state->nbStripesSoFar, state->nbStripesPerBlock,
1592 state->secret, state->secretLimit,
1594 state->bufferedSize = 0;
1598 if (input+XXH3_INTERNALBUFFER_SIZE <= bEnd) {
1599 const xxh_u8*
const limit = bEnd - XXH3_INTERNALBUFFER_SIZE;
1602 &state->nbStripesSoFar, state->nbStripesPerBlock,
1604 state->secret, state->secretLimit,
1606 input += XXH3_INTERNALBUFFER_SIZE;
1607 }
while (input<=limit);
1611 XXH_memcpy(state->buffer, input, (
size_t)(bEnd-input));
1612 state->bufferedSize = (XXH32_hash_t)(bEnd-input);
1626 XXH_FORCE_INLINE
void 1633 memcpy(acc, state->acc,
sizeof(state->acc));
1635 size_t const totalNbStripes = state->bufferedSize /
STRIPE_LEN;
1636 XXH32_hash_t nbStripesSoFar = state->nbStripesSoFar;
1638 &nbStripesSoFar, state->nbStripesPerBlock,
1639 state->buffer, totalNbStripes,
1640 state->secret, state->secretLimit,
1644 state->buffer + state->bufferedSize -
STRIPE_LEN,
1649 if (state->bufferedSize) {
1651 size_t const catchupSize =
STRIPE_LEN - state->bufferedSize;
1652 memcpy(lastStripe, state->buffer +
sizeof(state->buffer) - catchupSize, catchupSize);
1653 memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize);
1678 XXH_FORCE_INLINE XXH128_hash_t
1681 XXH_ASSERT(input != NULL);
1682 XXH_ASSERT(1 <= len && len <= 3);
1683 XXH_ASSERT(secret != NULL);
1689 { xxh_u8
const c1 = input[0];
1690 xxh_u8
const c2 = input[len >> 1];
1691 xxh_u8
const c3 = input[len - 1];
1692 xxh_u32
const combinedl = ((xxh_u32)c1<<16) | (((xxh_u32)c2) << 24) | (((xxh_u32)c3) << 0) | (((xxh_u32)len) << 8);
1693 xxh_u32
const combinedh = XXH_rotl32(XXH_swap32(combinedl), 13);
1694 xxh_u64
const bitflipl = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed;
1695 xxh_u64
const bitfliph = (XXH_readLE32(secret+8) ^ XXH_readLE32(secret+12)) - seed;
1696 xxh_u64
const keyed_lo = (xxh_u64)combinedl ^ bitflipl;
1697 xxh_u64
const keyed_hi = (xxh_u64)combinedh ^ bitfliph;
1698 xxh_u64
const mixedl = keyed_lo * PRIME64_1;
1699 xxh_u64
const mixedh = keyed_hi * PRIME64_5;
1705 XXH_FORCE_INLINE XXH128_hash_t
1708 XXH_ASSERT(input != NULL);
1709 XXH_ASSERT(secret != NULL);
1710 XXH_ASSERT(4 <= len && len <= 8);
1711 seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32;
1712 { xxh_u32
const input_lo = XXH_readLE32(input);
1713 xxh_u32
const input_hi = XXH_readLE32(input + len - 4);
1714 xxh_u64
const input_64 = input_lo + ((xxh_u64)input_hi << 32);
1715 xxh_u64
const bitflip = (XXH_readLE64(secret+16) ^ XXH_readLE64(secret+24)) + seed;
1716 xxh_u64
const keyed = input_64 ^ bitflip;
1721 m128.high64 += (m128.low64 << 1);
1722 m128.low64 ^= (m128.high64 >> 3);
1725 m128.low64 *= 0x9FB21C651E98DF25ULL;
1732 XXH_FORCE_INLINE XXH128_hash_t
1735 XXH_ASSERT(input != NULL);
1736 XXH_ASSERT(secret != NULL);
1737 XXH_ASSERT(9 <= len && len <= 16);
1738 { xxh_u64
const bitflipl = (XXH_readLE64(secret+32) ^ XXH_readLE64(secret+40)) - seed;
1739 xxh_u64
const bitfliph = (XXH_readLE64(secret+48) ^ XXH_readLE64(secret+56)) + seed;
1740 xxh_u64
const input_lo = XXH_readLE64(input);
1741 xxh_u64 input_hi = XXH_readLE64(input + len - 8);
1742 XXH128_hash_t m128 =
XXH_mult64to128(input_lo ^ input_hi ^ bitflipl, PRIME64_1);
1747 m128.low64 += (xxh_u64)(len - 1) << 54;
1748 input_hi ^= bitfliph;
1756 if (
sizeof(
void *) <
sizeof(xxh_u64)) {
1763 m128.high64 += (input_hi & 0xFFFFFFFF00000000) +
XXH_mult32to64((xxh_u32)input_hi, PRIME32_2);
1789 m128.high64 += input_hi +
XXH_mult32to64((xxh_u32)input_hi, PRIME32_2 - 1);
1792 m128.low64 ^= XXH_swap64(m128.high64);
1796 h128.high64 += m128.high64 * PRIME64_2;
1806 XXH_FORCE_INLINE XXH128_hash_t
1809 XXH_ASSERT(len <= 16);
1813 { XXH128_hash_t h128;
1814 xxh_u64
const bitflipl = XXH_readLE64(secret+64) ^ XXH_readLE64(secret+72);
1815 xxh_u64
const bitfliph = XXH_readLE64(secret+80) ^ XXH_readLE64(secret+88);
1825 XXH_FORCE_INLINE XXH128_hash_t
1828 acc.low64 +=
XXH3_mix16B (input_1, secret+0, seed);
1829 acc.low64 ^= XXH_readLE64(input_2) + XXH_readLE64(input_2 + 8);
1830 acc.high64 +=
XXH3_mix16B (input_2, secret+16, seed);
1831 acc.high64 ^= XXH_readLE64(input_1) + XXH_readLE64(input_1 + 8);
1836 XXH_FORCE_INLINE XXH128_hash_t
1841 XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize;
1842 XXH_ASSERT(16 < len && len <= 128);
1844 { XXH128_hash_t acc;
1845 acc.low64 = len * PRIME64_1;
1850 acc =
XXH128_mix32B(acc, input+48, input+len-64, secret+96, seed);
1852 acc =
XXH128_mix32B(acc, input+32, input+len-48, secret+64, seed);
1854 acc =
XXH128_mix32B(acc, input+16, input+len-32, secret+32, seed);
1856 acc =
XXH128_mix32B(acc, input, input+len-16, secret, seed);
1857 { xxh_u64
const low64 = acc.low64 + acc.high64;
1858 xxh_u64
const high64 = (acc.low64 * PRIME64_1) + (acc.high64 * PRIME64_4) + ((len - seed) * PRIME64_2);
1865 XXH_NO_INLINE XXH128_hash_t
1870 XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize;
1873 { XXH128_hash_t acc;
1874 int const nbRounds = (int)len / 32;
1876 acc.low64 = len * PRIME64_1;
1878 for (i=0; i<4; i++) {
1879 acc =
XXH128_mix32B(acc, input+(32*i), input+(32*i)+16, secret+(32*i), seed);
1883 XXH_ASSERT(nbRounds >= 4);
1884 for (i=4 ; i < nbRounds; i++) {
1890 { xxh_u64
const low64 = acc.low64 + acc.high64;
1891 xxh_u64
const high64 = (acc.low64 * PRIME64_1) + (acc.high64 * PRIME64_4) + ((len - seed) * PRIME64_2);
1898 XXH_FORCE_INLINE XXH128_hash_t
1907 XXH_STATIC_ASSERT(
sizeof(acc) == 64);
1911 XXH128_hash_t
const h128 = { low64, high64 };
1920 XXH_NO_INLINE XXH128_hash_t
1930 XXH_NO_INLINE XXH128_hash_t
1932 const xxh_u8* secret,
size_t secretSize)
1941 XXH_NO_INLINE XXH128_hash_t
1954 if (len <= 128)
return XXH3_len_17to128_128b((
const xxh_u8*)input, len, kSecret,
sizeof(kSecret), 0);
1962 XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN);
1969 if (len <= 16)
return XXH3_len_0to16_128b((
const xxh_u8*)input, len, (
const xxh_u8*)secret, 0);
1970 if (len <= 128)
return XXH3_len_17to128_128b((
const xxh_u8*)input, len, (
const xxh_u8*)secret, secretSize, 0);
1979 if (len <= 128)
return XXH3_len_17to128_128b((
const xxh_u8*)input, len, kSecret,
sizeof(kSecret), seed);
2000 const xxh_u8* secret,
size_t secretSize)
2019 if (secretSize < XXH3_SECRET_SIZE_MIN)
return XXH_ERROR;
2029 statePtr->secret = statePtr->customSecret;
2047 XXH128_hash_t
const h128 = { low64, high64 };
2065 return !(memcmp(&
h1, &
h2,
sizeof(
h1)));
2074 XXH128_hash_t
const h1 = *(
const XXH128_hash_t*)h128_1;
2075 XXH128_hash_t
const h2 = *(
const XXH128_hash_t*)h128_2;
2076 int const hcmp = (
h1.high64 >
h2.high64) - (
h2.high64 >
h1.high64);
2078 if (hcmp)
return hcmp;
2079 return (
h1.low64 >
h2.low64) - (
h2.low64 >
h1.low64);
2087 XXH_STATIC_ASSERT(
sizeof(XXH128_canonical_t) ==
sizeof(XXH128_hash_t));
2088 if (XXH_CPU_LITTLE_ENDIAN) {
2089 hash.high64 = XXH_swap64(hash.high64);
2090 hash.low64 = XXH_swap64(hash.low64);
2092 memcpy(dst, &hash.high64,
sizeof(hash.high64));
2093 memcpy((
char*)dst +
sizeof(hash.high64), &hash.low64,
sizeof(hash.low64));
2100 h.high64 = XXH_readBE64(src);
2101 h.low64 = XXH_readBE64(src->digest + 8);
2106 #if XXH_VECTOR == XXH_AVX2 \ 2107 && defined(__GNUC__) && !defined(__clang__) \ 2108 && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) 2109 # pragma GCC pop_options XXH_FORCE_INLINE XXH64_hash_t XXH3_len_9to16_64b(const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
XXH_FORCE_INLINE XXH128_hash_t XXH3_len_9to16_128b(const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest(const XXH3_state_t *state)
XXH_FORCE_INLINE void XXH3_accumulate_512(void *XXH_RESTRICT acc, const void *XXH_RESTRICT input, const void *XXH_RESTRICT secret, XXH3_accWidth_e accWidth)
XXH_FORCE_INLINE XXH64_hash_t XXH3_hashLong_internal(const xxh_u8 *XXH_RESTRICT input, size_t len, const xxh_u8 *XXH_RESTRICT secret, size_t secretSize)
#define XXH_PREFETCH_DIST
XXH_FORCE_INLINE void XXH3_initCustomSecret(xxh_u8 *customSecret, xxh_u64 seed64)
XXH_FORCE_INLINE XXH64_hash_t XXH3_len_17to128_64b(const xxh_u8 *XXH_RESTRICT input, size_t len, const xxh_u8 *XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed)
XXH_FORCE_INLINE XXH_errorcode XXH3_update(XXH3_state_t *state, const xxh_u8 *input, size_t len, XXH3_accWidth_e accWidth)
XXH_FORCE_INLINE void XXH3_consumeStripes(xxh_u64 *acc, XXH32_hash_t *nbStripesSoFarPtr, XXH32_hash_t nbStripesPerBlock, const xxh_u8 *input, size_t totalStripes, const xxh_u8 *secret, size_t secretLimit, XXH3_accWidth_e accWidth)
XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH3_state_t *statePtr)
XXH_FORCE_INLINE void XXH3_accumulate(xxh_u64 *XXH_RESTRICT acc, const xxh_u8 *XXH_RESTRICT input, const xxh_u8 *XXH_RESTRICT secret, size_t nbStripes, XXH3_accWidth_e accWidth)
XXH_FORCE_INLINE void XXH3_scrambleAcc(void *XXH_RESTRICT acc, const void *XXH_RESTRICT secret)
XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift)
static XXH64_hash_t XXH3_mergeAccs(const xxh_u64 *XXH_RESTRICT acc, const xxh_u8 *XXH_RESTRICT secret, xxh_u64 start)
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH3_state_t *statePtr)
#define XXH_mult32to64(x, y)
static void h2(float r, float r2, float ri, float rc, float r0, float rs, float &h)
XXH_NO_INLINE XXH128_hash_t XXH3_len_129to240_128b(const xxh_u8 *XXH_RESTRICT input, size_t len, const xxh_u8 *XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed)
XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void *input, size_t len)
XXH_FORCE_INLINE XXH64_hash_t XXH3_len_0to16_64b(const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
XXH_FORCE_INLINE void XXH_writeLE64(void *dst, xxh_u64 v64)
#define XXH3_MIDSIZE_LASTOFFSET
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH3_state_t *statePtr, XXH64_hash_t seed)
#define XXH_PREFETCH(ptr)
XXH_NO_INLINE XXH128_hash_t XXH3_hashLong_128b_defaultSecret(const xxh_u8 *input, size_t len)
XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed(const void *input, size_t len, XXH64_hash_t seed)
static void h1(float r, float r2, float ri, float rc, float r0, float rs, float &h)
static XXH64_hash_t XXH3_avalanche(xxh_u64 h64)
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH3_state_t *statePtr, const void *secret, size_t secretSize)
XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void *input, size_t len, const void *secret, size_t secretSize)
unsigned long long XXH64_hash_t
XXH_ALIGN(64) static const xxh_u8 kSecret[XXH_SECRET_DEFAULT_SIZE]
#define XXH_SECRET_LASTACC_START
XXH_NO_INLINE XXH64_hash_t XXH3_hashLong_64b_withSeed(const xxh_u8 *input, size_t len, XXH64_hash_t seed)
XXH_NO_INLINE XXH64_hash_t XXH3_len_129to240_64b(const xxh_u8 *XXH_RESTRICT input, size_t len, const xxh_u8 *XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed)
XXH_FORCE_INLINE xxh_u64 XXH3_mix2Accs(const xxh_u64 *XXH_RESTRICT acc, const xxh_u8 *XXH_RESTRICT secret)
XXH_FORCE_INLINE XXH128_hash_t XXH3_hashLong_128b_internal(const xxh_u8 *XXH_RESTRICT input, size_t len, const xxh_u8 *XXH_RESTRICT secret, size_t secretSize)
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update(XXH3_state_t *state, const void *input, size_t len)
static void XXH3_64bits_reset_internal(XXH3_state_t *statePtr, XXH64_hash_t seed, const xxh_u8 *secret, size_t secretSize)
XXH_FORCE_INLINE void XXH3_hashLong_internal_loop(xxh_u64 *XXH_RESTRICT acc, const xxh_u8 *XXH_RESTRICT input, size_t len, const xxh_u8 *XXH_RESTRICT secret, size_t secretSize, XXH3_accWidth_e accWidth)
static XXH128_hash_t XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs)
XXH_FORCE_INLINE XXH128_hash_t XXH3_len_4to8_128b(const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
XXH_FORCE_INLINE XXH128_hash_t XXH3_len_0to16_128b(const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
#define XXH_SECRET_CONSUME_RATE
XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t *statePtr)
XXH_PUBLIC_API int XXH128_cmp(const void *h128_1, const void *h128_2)
XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest(const XXH3_state_t *state)
#define XXH3_MIDSIZE_STARTOFFSET
XXH_FORCE_INLINE XXH64_hash_t XXH3_len_4to8_64b(const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
XXH_NO_INLINE XXH64_hash_t XXH3_hashLong_64b_withSecret(const xxh_u8 *XXH_RESTRICT input, size_t len, const xxh_u8 *XXH_RESTRICT secret, size_t secretSize)
static void XXH3_128bits_reset_internal(XXH3_state_t *statePtr, XXH64_hash_t seed, const xxh_u8 *secret, size_t secretSize)
XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t *src)
XXH_FORCE_INLINE XXH64_hash_t XXH3_len_1to3_64b(const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update(XXH3_state_t *state, const void *input, size_t len)
XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void *input, size_t len, XXH64_hash_t seed)
#define XXH_SECRET_MERGEACCS_START
XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH3_state_t *statePtr, XXH64_hash_t seed)
XXH_PUBLIC_API XXH3_state_t * XXH3_createState(void)
XXH_FORCE_INLINE XXH128_hash_t XXH3_len_17to128_128b(const xxh_u8 *XXH_RESTRICT input, size_t len, const xxh_u8 *XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed)
XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void *input, size_t len)
XXH_FORCE_INLINE void XXH3_digest_long(XXH64_hash_t *acc, const XXH3_state_t *state, XXH3_accWidth_e accWidth)
XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2)
#define XXH_SECRET_DEFAULT_SIZE
XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void *input, size_t len, const void *secret, size_t secretSize)
XXH_FORCE_INLINE xxh_u64 XXH3_mix16B(const xxh_u8 *XXH_RESTRICT input, const xxh_u8 *XXH_RESTRICT secret, xxh_u64 seed64)
XXH_PUBLIC_API XXH128_hash_t XXH128(const void *input, size_t len, XXH64_hash_t seed)
static xxh_u64 XXH3_mul128_fold64(xxh_u64 lhs, xxh_u64 rhs)
XXH_NO_INLINE XXH128_hash_t XXH3_hashLong_128b_withSeed(const xxh_u8 *input, size_t len, XXH64_hash_t seed)
XXH_NO_INLINE XXH64_hash_t XXH3_hashLong_64b_defaultSecret(const xxh_u8 *XXH_RESTRICT input, size_t len)
XXH_PUBLIC_API void XXH3_copyState(XXH3_state_t *dst_state, const XXH3_state_t *src_state)
XXH_FORCE_INLINE XXH128_hash_t XXH3_len_1to3_128b(const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
XXH_NO_INLINE XXH128_hash_t XXH3_hashLong_128b_withSecret(const xxh_u8 *input, size_t len, const xxh_u8 *secret, size_t secretSize)
XXH_FORCE_INLINE XXH128_hash_t XXH128_mix32B(XXH128_hash_t acc, const xxh_u8 *input_1, const xxh_u8 *input_2, const xxh_u8 *secret, XXH64_hash_t seed)
#define XXH3_INTERNALBUFFER_STRIPES
XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH3_state_t *statePtr, const void *secret, size_t secretSize)
XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH128_canonical_t *dst, XXH128_hash_t hash)