xxHash  0.8.0
Extremely fast non-cryptographic hash function
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
xxhash.h File Reference
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <altivec.h>

Go to the source code of this file.

Data Structures

struct  XXH32_canonical_t
 Canonical (big endian) representation of XXH32_hash_t. More...
 
struct  XXH64_canonical_t
 
struct  XXH128_hash_t
 The return value from 128-bit hashes. More...
 
struct  XXH128_canonical_t
 
struct  XXH32_state_s
 Structure for XXH32 streaming API. More...
 
struct  XXH64_state_s
 Structure for XXH64 streaming API. More...
 
struct  XXH3_state_s
 Structure for XXH3 streaming API. More...
 

Macros

#define XXHASH_H_5627135585666179   1
 
#define XXH_PUBLIC_API   /* do nothing */
 
#define XXH_NAMESPACE   /* YOUR NAME HERE */
 Emulate a namespace by transparently prefixing all symbols. More...
 
#define XXH_VERSION_MAJOR   0
 
#define XXH_VERSION_MINOR   8
 
#define XXH_VERSION_RELEASE   1
 
#define XXH_VERSION_NUMBER   (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE)
 
#define XXH_HAS_ATTRIBUTE(x)   0
 
#define XXH_HAS_C_ATTRIBUTE(x)   0
 
#define XXH_HAS_CPP_ATTRIBUTE(x)   0
 
#define XXH_FALLTHROUGH
 
#define XXH3_SECRET_SIZE_MIN   136
 
#define XXHASH_H_STATIC_13879238742
 
#define XXH_ALIGN(n)   /* disabled */
 
#define XXH_ALIGN_MEMBER(align, type)   XXH_ALIGN(align) type
 
#define XXH3_INTERNALBUFFER_SIZE   256
 The size of the internal XXH3 buffer. More...
 
#define XXH3_SECRET_DEFAULT_SIZE   192
 Default size of the secret buffer (and XXH3_kSecret). More...
 
#define XXH3_INITSTATE(XXH3_state_ptr)   { (XXH3_state_ptr)->seed = 0; }
 Initializes a stack-allocated XXH3_state_s. More...
 
#define XXH_IMPLEM_13a8737387
 
#define XXH_NO_LONG_LONG
 Define this to disable 64-bit code. More...
 
#define XXH_FORCE_MEMORY_ACCESS   0
 Controls how unaligned memory is accessed. More...
 
#define XXH_FORCE_ALIGN_CHECK   0
 If defined to non-zero, adds a special path for aligned inputs (XXH32() and XXH64() only). More...
 
#define XXH_NO_INLINE_HINTS   0
 When non-zero, sets all functions to static. More...
 
#define XXH32_ENDJMP   0
 Whether to use a jump for XXH32_finalize. More...
 
#define XXH_OLD_NAMES
 Redefines old internal names. More...
 
#define XXH_FORCE_INLINE   static
 
#define XXH_NO_INLINE   static
 
#define XXH_DEBUGLEVEL   0
 Sets the debugging level. More...
 
#define XXH_ASSERT(c)   ((void)0)
 
#define XXH_STATIC_ASSERT_WITH_MESSAGE(c, m)   do { struct xxh_sa { char x[(c) ? 1 : -1]; }; } while(0)
 
#define XXH_STATIC_ASSERT(c)   XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
 
#define XXH_COMPILER_GUARD(var)   ((void)0)
 Used to prevent unwanted optimizations for var. More...
 
#define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
 Whether the target is little endian. More...
 
#define XXH_GCC_VERSION   (__GNUC__ * 100 + __GNUC_MINOR__)
 
#define XXH_HAS_BUILTIN(x)   0
 
#define XXH_rotl32(x, r)   (((x) << (r)) | ((x) >> (32 - (r))))
 32-bit rotate left. More...
 
#define XXH_rotl64(x, r)   (((x) << (r)) | ((x) >> (64 - (r))))
 
#define XXH_PRIME32_1   0x9E3779B1U
 
#define XXH_PRIME32_2   0x85EBCA77U
 
#define XXH_PRIME32_3   0xC2B2AE3DU
 
#define XXH_PRIME32_4   0x27D4EB2FU
 
#define XXH_PRIME32_5   0x165667B1U
 
#define XXH_get32bits(p)   XXH_readLE32_align(p, align)
 
#define XXH_PROCESS1
 
#define XXH_PROCESS4
 
#define XXH_PRIME64_1   0x9E3779B185EBCA87ULL
 
#define XXH_PRIME64_2   0xC2B2AE3D27D4EB4FULL
 
#define XXH_PRIME64_3   0x165667B19E3779F9ULL
 
#define XXH_PRIME64_4   0x85EBCA77C2B2AE63ULL
 
#define XXH_PRIME64_5   0x27D4EB2F165667C5ULL
 
#define XXH_get64bits(p)   XXH_readLE64_align(p, align)
 
#define XXH_RESTRICT   /* disable */
 
#define XXH_likely(x)   (x)
 
#define XXH_unlikely(x)   (x)
 
#define XXH_VECTOR   XXH_SCALAR
 Overrides the vectorization implementation chosen for XXH3. More...
 
#define XXH_ACC_ALIGN   8
 Selects the minimum alignment for XXH3's accumulators. More...
 
#define XXH_SEC_ALIGN   XXH_ACC_ALIGN
 
#define XXH_SPLIT_IN_PLACE(in, outLo, outHi)
 
#define XXH_VSX_BE   0
 
#define XXH_PREFETCH(ptr)   (void)(ptr) /* disabled */
 
#define XXH_SECRET_DEFAULT_SIZE   192 /* minimum XXH3_SECRET_SIZE_MIN */
 
#define XXH3_MIDSIZE_MAX   240
 
#define XXH3_MIDSIZE_STARTOFFSET   3
 
#define XXH3_MIDSIZE_LASTOFFSET   17
 
#define XXH_STRIPE_LEN   64
 
#define XXH_SECRET_CONSUME_RATE   8 /* nb of secret bytes consumed at each accumulation */
 
#define XXH_ACC_NB   (XXH_STRIPE_LEN / sizeof(xxh_u64))
 
#define XXH_TARGET_AVX512   /* disable attribute target */
 Like XXH_TARGET_SSE2, but for AVX512.
 
#define XXH_TARGET_AVX2   /* disable attribute target */
 Like XXH_TARGET_SSE2, but for AVX2.
 
#define XXH_TARGET_SSE2   /* disable attribute target */
 Allows a function to be compiled with SSE2 intrinsics. More...
 
#define XXH3_accumulate_512   XXH3_accumulate_512_avx512
 
#define XXH3_scrambleAcc   XXH3_scrambleAcc_avx512
 
#define XXH3_initCustomSecret   XXH3_initCustomSecret_avx512
 
#define XXH_PREFETCH_DIST   512
 
#define XXH_SECRET_LASTACC_START   7 /* not aligned on 8, last secret is different from acc & scrambler */
 
#define XXH3_INIT_ACC
 
#define XXH_SECRET_MERGEACCS_START   11
 
#define XXH3_STREAM_USE_STACK   1
 
#define XXH3_INTERNALBUFFER_STRIPES   (XXH3_INTERNALBUFFER_SIZE / XXH_STRIPE_LEN)
 
#define XXH_MIN(x, y)   (((x) > (y)) ? (y) : (x))
 

Typedefs

typedef uint32_t XXH32_hash_t
 An unsigned 32-bit integer. More...
 
typedef struct XXH32_state_s XXH32_state_t
 The opaque state struct for the XXH32 streaming API. More...
 
typedef struct XXH64_state_s XXH64_state_t
 The opaque state struct for the XXH64 streaming API. More...
 
typedef struct XXH3_state_s XXH3_state_t
 The state struct for the XXH3 streaming API. More...
 
typedef unsigned char xxh_u8
 
typedef XXH32_hash_t xxh_u32
 
typedef __vector unsigned long long xxh_u64x2
 
typedef __vector unsigned char xxh_u8x16
 
typedef __vector unsigned xxh_u32x4
 
typedef long long xxh_i64
 
typedef void(* XXH3_f_accumulate_512) (void *restrict, const void *, const void *)
 
typedef void(* XXH3_f_scrambleAcc) (void *restrict, const void *)
 
typedef void(* XXH3_f_initCustomSecret) (void *restrict, xxh_u64)
 
typedef XXH64_hash_t(* XXH3_hashLong64_f) (const void *restrict, size_t, XXH64_hash_t, const xxh_u8 *restrict, size_t)
 
typedef XXH128_hash_t(* XXH3_hashLong128_f) (const void *restrict, size_t, XXH64_hash_t, const void *restrict, size_t)
 
typedef uint64_t XXH64_hash_t
 An unsigned 64-bit integer. More...
 

Enumerations

enum  XXH_errorcode { XXH_OK =0 , XXH_ERROR }
 
enum  XXH_alignment { XXH_aligned , XXH_unaligned }
 Enum to indicate whether a pointer is aligned. More...
 
enum  XXH_VECTOR_TYPE {
  XXH_SCALAR = 0 , XXH_SSE2 = 1 , XXH_AVX2 = 2 , XXH_AVX512 = 3 ,
  XXH_NEON = 4 , XXH_VSX = 5
}
 Possible values for XXH_VECTOR. More...
 

Functions

unsigned XXH_versionNumber (void)
 Obtains the xxHash version. More...
 
XXH32_hash_t XXH32 (const void *input, size_t length, XXH32_hash_t seed)
 Calculates the 32-bit hash of input using xxHash32. More...
 
XXH32_state_tXXH32_createState (void)
 Allocates an XXH32_state_t. More...
 
XXH_errorcode XXH32_freeState (XXH32_state_t *statePtr)
 Frees an XXH32_state_t. More...
 
void XXH32_copyState (XXH32_state_t *dst_state, const XXH32_state_t *src_state)
 Copies one XXH32_state_t to another. More...
 
XXH_errorcode XXH32_reset (XXH32_state_t *statePtr, XXH32_hash_t seed)
 Resets an XXH32_state_t to begin a new hash. More...
 
XXH_errorcode XXH32_update (XXH32_state_t *statePtr, const void *input, size_t length)
 Consumes a block of input to an XXH32_state_t. More...
 
XXH32_hash_t XXH32_digest (const XXH32_state_t *statePtr)
 Returns the calculated hash value from an XXH32_state_t. More...
 
void XXH32_canonicalFromHash (XXH32_canonical_t *dst, XXH32_hash_t hash)
 Converts an XXH32_hash_t to a big endian XXH32_canonical_t. More...
 
XXH32_hash_t XXH32_hashFromCanonical (const XXH32_canonical_t *src)
 Converts an XXH32_canonical_t to a native XXH32_hash_t. More...
 
XXH64_hash_t XXH64 (const void *input, size_t length, XXH64_hash_t seed)
 Calculates the 64-bit hash of input using xxHash64. More...
 
XXH64_state_tXXH64_createState (void)
 
XXH_errorcode XXH64_freeState (XXH64_state_t *statePtr)
 
void XXH64_copyState (XXH64_state_t *dst_state, const XXH64_state_t *src_state)
 
XXH_errorcode XXH64_reset (XXH64_state_t *statePtr, XXH64_hash_t seed)
 
XXH_errorcode XXH64_update (XXH64_state_t *statePtr, const void *input, size_t length)
 
XXH64_hash_t XXH64_digest (const XXH64_state_t *statePtr)
 
void XXH64_canonicalFromHash (XXH64_canonical_t *dst, XXH64_hash_t hash)
 
XXH64_hash_t XXH64_hashFromCanonical (const XXH64_canonical_t *src)
 
XXH64_hash_t XXH3_64bits (const void *data, size_t len)
 
XXH64_hash_t XXH3_64bits_withSeed (const void *data, size_t len, XXH64_hash_t seed)
 
XXH64_hash_t XXH3_64bits_withSecret (const void *data, size_t len, const void *secret, size_t secretSize)
 
XXH3_state_tXXH3_createState (void)
 
XXH_errorcode XXH3_freeState (XXH3_state_t *statePtr)
 
void XXH3_copyState (XXH3_state_t *dst_state, const XXH3_state_t *src_state)
 
XXH_errorcode XXH3_64bits_reset (XXH3_state_t *statePtr)
 
XXH_errorcode XXH3_64bits_reset_withSeed (XXH3_state_t *statePtr, XXH64_hash_t seed)
 
XXH_errorcode XXH3_64bits_reset_withSecret (XXH3_state_t *statePtr, const void *secret, size_t secretSize)
 
XXH_errorcode XXH3_64bits_update (XXH3_state_t *statePtr, const void *input, size_t length)
 
XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t *statePtr)
 
XXH128_hash_t XXH3_128bits (const void *data, size_t len)
 
XXH128_hash_t XXH3_128bits_withSeed (const void *data, size_t len, XXH64_hash_t seed)
 
XXH128_hash_t XXH3_128bits_withSecret (const void *data, size_t len, const void *secret, size_t secretSize)
 
XXH_errorcode XXH3_128bits_reset (XXH3_state_t *statePtr)
 
XXH_errorcode XXH3_128bits_reset_withSeed (XXH3_state_t *statePtr, XXH64_hash_t seed)
 
XXH_errorcode XXH3_128bits_reset_withSecret (XXH3_state_t *statePtr, const void *secret, size_t secretSize)
 
XXH_errorcode XXH3_128bits_update (XXH3_state_t *statePtr, const void *input, size_t length)
 
XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t *statePtr)
 
int XXH128_isEqual (XXH128_hash_t h1, XXH128_hash_t h2)
 
int XXH128_cmp (const void *h128_1, const void *h128_2)
 
void XXH128_canonicalFromHash (XXH128_canonical_t *dst, XXH128_hash_t hash)
 
XXH128_hash_t XXH128_hashFromCanonical (const XXH128_canonical_t *src)
 
XXH128_hash_t XXH128 (const void *data, size_t len, XXH64_hash_t seed)
 
XXH_errorcode XXH3_generateSecret (void *secretBuffer, size_t secretSize, const void *customSeed, size_t customSeedSize)
 
void XXH3_generateSecret_fromSeed (void *secretBuffer, XXH64_hash_t seed)
 
XXH64_hash_t XXH3_64bits_withSecretandSeed (const void *data, size_t len, const void *secret, size_t secretSize, XXH64_hash_t seed)
 
XXH128_hash_t XXH3_128bits_withSecretandSeed (const void *data, size_t len, const void *secret, size_t secretSize, XXH64_hash_t seed64)
 
XXH_errorcode XXH3_64bits_reset_withSecretandSeed (XXH3_state_t *statePtr, const void *secret, size_t secretSize, XXH64_hash_t seed64)
 
XXH_errorcode XXH3_128bits_reset_withSecretandSeed (XXH3_state_t *statePtr, const void *secret, size_t secretSize, XXH64_hash_t seed64)
 
static void * XXH_malloc (size_t s)
 Modify this function to use a different routine than malloc(). More...
 
static void XXH_free (void *p)
 Modify this function to use a different routine than free(). More...
 
static void * XXH_memcpy (void *dest, const void *src, size_t size)
 Modify this function to use a different routine than memcpy(). More...
 
static xxh_u32 XXH_read32 (const void *memPtr)
 Reads an unaligned 32-bit integer from ptr in native endianness. More...
 
static int XXH_isLittleEndian (void)
 Runtime check for XXH_CPU_LITTLE_ENDIAN. More...
 
static xxh_u32 XXH_swap32 (xxh_u32 x)
 A 32-bit byteswap. More...
 
static xxh_u32 XXH_readLE32 (const void *ptr)
 Reads an unaligned 32-bit little endian integer from ptr. More...
 
static xxh_u32 XXH_readBE32 (const void *ptr)
 Reads an unaligned 32-bit big endian integer from ptr. More...
 
static xxh_u32 XXH_readLE32_align (const void *ptr, XXH_alignment align)
 Like XXH_readLE32(), but has an option for aligned reads. More...
 
static xxh_u32 XXH32_round (xxh_u32 acc, xxh_u32 input)
 Normal stripe processing routine. More...
 
static xxh_u32 XXH32_avalanche (xxh_u32 h32)
 Mixes all bits to finalize the hash. More...
 
static xxh_u32 XXH32_finalize (xxh_u32 h32, const xxh_u8 *ptr, size_t len, XXH_alignment align)
 Processes the last 0-15 bytes of ptr. More...
 
static xxh_u32 XXH32_endian_align (const xxh_u8 *input, size_t len, xxh_u32 seed, XXH_alignment align)
 The implementation for XXH32(). More...
 
static xxh_u64 XXH64_round (xxh_u64 acc, xxh_u64 input)
 
static xxh_u64 XXH64_mergeRound (xxh_u64 acc, xxh_u64 val)
 
static xxh_u64 XXH64_avalanche (xxh_u64 h64)
 
static xxh_u64 XXH64_finalize (xxh_u64 h64, const xxh_u8 *ptr, size_t len, XXH_alignment align)
 
static xxh_u64 XXH64_endian_align (const xxh_u8 *input, size_t len, xxh_u64 seed, XXH_alignment align)
 
static xxh_u64x2 XXH_vec_loadu (const void *ptr)
 
static xxh_u64x2 XXH_vec_mulo (xxh_u32x4 a, xxh_u32x4 b)
 
static xxh_u64x2 XXH_vec_mule (xxh_u32x4 a, xxh_u32x4 b)
 
static xxh_u64 XXH_mult32to64 (xxh_u64 x, xxh_u64 y)
 Calculates a 32-bit to 64-bit long multiply. More...
 
static XXH128_hash_t XXH_mult64to128 (xxh_u64 lhs, xxh_u64 rhs)
 Calculates a 64->128-bit long multiply. More...
 
static xxh_u64 XXH3_mul128_fold64 (xxh_u64 lhs, xxh_u64 rhs)
 Calculates a 64-bit to 128-bit multiply, then XOR folds it. More...
 
static xxh_u64 XXH_xorshift64 (xxh_u64 v64, int shift)
 
static XXH64_hash_t XXH3_avalanche (xxh_u64 h64)
 
static XXH64_hash_t XXH3_rrmxmx (xxh_u64 h64, xxh_u64 len)
 
static XXH64_hash_t XXH3_len_1to3_64b (const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
 
static XXH64_hash_t XXH3_len_4to8_64b (const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
 
static XXH64_hash_t XXH3_len_9to16_64b (const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
 
static XXH64_hash_t XXH3_len_0to16_64b (const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
 
static xxh_u64 XXH3_mix16B (const xxh_u8 *restrict input, const xxh_u8 *restrict secret, xxh_u64 seed64)
 
static XXH64_hash_t XXH3_len_17to128_64b (const xxh_u8 *restrict input, size_t len, const xxh_u8 *restrict secret, size_t secretSize, XXH64_hash_t seed)
 
static XXH64_hash_t XXH3_len_129to240_64b (const xxh_u8 *restrict input, size_t len, const xxh_u8 *restrict secret, size_t secretSize, XXH64_hash_t seed)
 
static void XXH_writeLE64 (void *dst, xxh_u64 v64)
 
static XXH_TARGET_AVX512 void XXH3_accumulate_512_avx512 (void *restrict acc, const void *restrict input, const void *restrict secret)
 
static XXH_TARGET_AVX512 void XXH3_scrambleAcc_avx512 (void *restrict acc, const void *restrict secret)
 
static XXH_TARGET_AVX512 void XXH3_initCustomSecret_avx512 (void *restrict customSecret, xxh_u64 seed64)
 
static XXH_TARGET_AVX2 void XXH3_accumulate_512_avx2 (void *restrict acc, const void *restrict input, const void *restrict secret)
 
static XXH_TARGET_AVX2 void XXH3_scrambleAcc_avx2 (void *restrict acc, const void *restrict secret)
 
static XXH_TARGET_AVX2 void XXH3_initCustomSecret_avx2 (void *restrict customSecret, xxh_u64 seed64)
 
static XXH_TARGET_SSE2 void XXH3_accumulate_512_sse2 (void *restrict acc, const void *restrict input, const void *restrict secret)
 
static XXH_TARGET_SSE2 void XXH3_scrambleAcc_sse2 (void *restrict acc, const void *restrict secret)
 
static XXH_TARGET_SSE2 void XXH3_initCustomSecret_sse2 (void *restrict customSecret, xxh_u64 seed64)
 
static void XXH3_accumulate_512_neon (void *restrict acc, const void *restrict input, const void *restrict secret)
 
static void XXH3_scrambleAcc_neon (void *restrict acc, const void *restrict secret)
 
static void XXH3_accumulate_512_vsx (void *restrict acc, const void *restrict input, const void *restrict secret)
 
static void XXH3_scrambleAcc_vsx (void *restrict acc, const void *restrict secret)
 
static void XXH3_accumulate_512_scalar (void *restrict acc, const void *restrict input, const void *restrict secret)
 
static void XXH3_scrambleAcc_scalar (void *restrict acc, const void *restrict secret)
 
static void XXH3_initCustomSecret_scalar (void *restrict customSecret, xxh_u64 seed64)
 
static void XXH3_accumulate (xxh_u64 *restrict acc, const xxh_u8 *restrict input, const xxh_u8 *restrict secret, size_t nbStripes, XXH3_f_accumulate_512 f_acc512)
 
static void XXH3_hashLong_internal_loop (xxh_u64 *restrict acc, const xxh_u8 *restrict input, size_t len, const xxh_u8 *restrict secret, size_t secretSize, XXH3_f_accumulate_512 f_acc512, XXH3_f_scrambleAcc f_scramble)
 
static xxh_u64 XXH3_mix2Accs (const xxh_u64 *restrict acc, const xxh_u8 *restrict secret)
 
static XXH64_hash_t XXH3_mergeAccs (const xxh_u64 *restrict acc, const xxh_u8 *restrict secret, xxh_u64 start)
 
static XXH64_hash_t XXH3_hashLong_64b_internal (const void *restrict input, size_t len, const void *restrict secret, size_t secretSize, XXH3_f_accumulate_512 f_acc512, XXH3_f_scrambleAcc f_scramble)
 
static XXH64_hash_t XXH3_hashLong_64b_withSecret (const void *restrict input, size_t len, XXH64_hash_t seed64, const xxh_u8 *restrict secret, size_t secretLen)
 
static XXH64_hash_t XXH3_hashLong_64b_default (const void *restrict input, size_t len, XXH64_hash_t seed64, const xxh_u8 *restrict secret, size_t secretLen)
 
static XXH64_hash_t XXH3_hashLong_64b_withSeed_internal (const void *input, size_t len, XXH64_hash_t seed, XXH3_f_accumulate_512 f_acc512, XXH3_f_scrambleAcc f_scramble, XXH3_f_initCustomSecret f_initSec)
 
static XXH64_hash_t XXH3_hashLong_64b_withSeed (const void *input, size_t len, XXH64_hash_t seed, const xxh_u8 *secret, size_t secretLen)
 
static XXH64_hash_t XXH3_64bits_internal (const void *restrict input, size_t len, XXH64_hash_t seed64, const void *restrict secret, size_t secretLen, XXH3_hashLong64_f f_hashLong)
 
static void * XXH_alignedMalloc (size_t s, size_t align)
 
static void XXH_alignedFree (void *p)
 
static void XXH3_reset_internal (XXH3_state_t *statePtr, XXH64_hash_t seed, const void *secret, size_t secretSize)
 
static void XXH3_consumeStripes (xxh_u64 *restrict acc, size_t *restrict nbStripesSoFarPtr, size_t nbStripesPerBlock, const xxh_u8 *restrict input, size_t nbStripes, const xxh_u8 *restrict secret, size_t secretLimit, XXH3_f_accumulate_512 f_acc512, XXH3_f_scrambleAcc f_scramble)
 
static XXH_errorcode XXH3_update (XXH3_state_t *restrict const state, const xxh_u8 *restrict input, size_t len, XXH3_f_accumulate_512 f_acc512, XXH3_f_scrambleAcc f_scramble)
 
static void XXH3_digest_long (XXH64_hash_t *acc, const XXH3_state_t *state, const unsigned char *secret)
 
static XXH128_hash_t XXH3_len_1to3_128b (const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
 
static XXH128_hash_t XXH3_len_4to8_128b (const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
 
static XXH128_hash_t XXH3_len_9to16_128b (const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
 
static XXH128_hash_t XXH3_len_0to16_128b (const xxh_u8 *input, size_t len, const xxh_u8 *secret, XXH64_hash_t seed)
 
static 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)
 
static XXH128_hash_t XXH3_len_17to128_128b (const xxh_u8 *restrict input, size_t len, const xxh_u8 *restrict secret, size_t secretSize, XXH64_hash_t seed)
 
static XXH128_hash_t XXH3_len_129to240_128b (const xxh_u8 *restrict input, size_t len, const xxh_u8 *restrict secret, size_t secretSize, XXH64_hash_t seed)
 
static XXH128_hash_t XXH3_hashLong_128b_internal (const void *restrict input, size_t len, const xxh_u8 *restrict secret, size_t secretSize, XXH3_f_accumulate_512 f_acc512, XXH3_f_scrambleAcc f_scramble)
 
static XXH128_hash_t XXH3_hashLong_128b_default (const void *restrict input, size_t len, XXH64_hash_t seed64, const void *restrict secret, size_t secretLen)
 
static XXH128_hash_t XXH3_hashLong_128b_withSecret (const void *restrict input, size_t len, XXH64_hash_t seed64, const void *restrict secret, size_t secretLen)
 
static XXH128_hash_t XXH3_hashLong_128b_withSeed_internal (const void *restrict input, size_t len, XXH64_hash_t seed64, XXH3_f_accumulate_512 f_acc512, XXH3_f_scrambleAcc f_scramble, XXH3_f_initCustomSecret f_initSec)
 
static XXH128_hash_t XXH3_hashLong_128b_withSeed (const void *input, size_t len, XXH64_hash_t seed64, const void *restrict secret, size_t secretLen)
 
static XXH128_hash_t XXH3_128bits_internal (const void *input, size_t len, XXH64_hash_t seed64, const void *restrict secret, size_t secretLen, XXH3_hashLong128_f f_hl128)
 
static void XXH3_combine16 (void *dst, XXH128_hash_t h128)
 

Variables

static const xxh_u8 XXH3_kSecret [XXH_SECRET_DEFAULT_SIZE]
 
typedef XXH64_hash_t xxh_u64
 
static xxh_u64 XXH_read64 (const void *memPtr)
 
static xxh_u64 XXH_swap64 (xxh_u64 x)
 
static xxh_u64 XXH_readLE64 (const void *ptr)
 
static xxh_u64 XXH_readBE64 (const void *ptr)
 
static xxh_u64 XXH_readLE64_align (const void *ptr, XXH_alignment align)
 

Detailed Description

xxHash prototypes and implementation

Macro Definition Documentation

◆ XXHASH_H_5627135585666179

#define XXHASH_H_5627135585666179   1

XXH_INLINE_ALL (and XXH_PRIVATE_API) Use these build macros to inline xxhash into the target unit. Inlining improves performance on small inputs, especially when the length is expressed as a compile-time constant:

 https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html

It also keeps xxHash symbols private to the unit, so they are not exported.

Usage: #define XXH_INLINE_ALL #include "xxhash.h"

Do not compile and link xxhash.o as a separate object, as it is not useful.

◆ XXH3_INTERNALBUFFER_SIZE

#define XXH3_INTERNALBUFFER_SIZE   256

The size of the internal XXH3 buffer.

This is the optimal update size for incremental hashing.

See also
XXH3_64b_update(), XXH3_128b_update().

◆ XXH3_SECRET_DEFAULT_SIZE

#define XXH3_SECRET_DEFAULT_SIZE   192

Default size of the secret buffer (and XXH3_kSecret).

This is the size used in XXH3_kSecret and the seeded functions.

Not to be confused with XXH3_SECRET_SIZE_MIN.

◆ XXH3_INITSTATE

#define XXH3_INITSTATE (   XXH3_state_ptr)    { (XXH3_state_ptr)->seed = 0; }

Initializes a stack-allocated XXH3_state_s.

When the XXH3_state_t structure is merely emplaced on stack, it should be initialized with XXH3_INITSTATE() or a memset() in case its first reset uses XXH3_NNbits_reset_withSeed(). This init can be omitted if the first reset uses default or _withSecret mode. This operation isn't necessary when the state is created with XXH3_createState(). Note that this doesn't prepare the state for a streaming operation, it's still necessary to use XXH3_NNbits_reset*() afterwards.

◆ XXH_PROCESS1

#define XXH_PROCESS1
Value:
do { \
h32 += (*ptr++) * XXH_PRIME32_5; \
h32 = XXH_rotl32(h32, 11) * XXH_PRIME32_1; \
} while (0)
#define XXH_rotl32(x, r)
32-bit rotate left.
Definition: xxhash.h:1784
#define XXH_PRIME32_1
Definition: xxhash.h:1889
#define XXH_PRIME32_5
Definition: xxhash.h:1893

◆ XXH_PROCESS4

#define XXH_PROCESS4
Value:
do { \
h32 += XXH_get32bits(ptr) * XXH_PRIME32_3; \
ptr += 4; \
h32 = XXH_rotl32(h32, 17) * XXH_PRIME32_4; \
} while (0)
#define XXH_PRIME32_4
Definition: xxhash.h:1892
#define XXH_PRIME32_3
Definition: xxhash.h:1891