ReactOS  0.4.15-dev-321-g2d9b385
xxhash.c File Reference
#include <stdlib.h>
#include <stddef.h>
#include <ntifs.h>
#include <ntddk.h>
#include <string.h>
#include "xxhash.h"
Include dependency graph for xxhash.c:

Go to the source code of this file.

Macros

#define XXH_FORCE_NATIVE_FORMAT   0
 
#define XXH_FORCE_ALIGN_CHECK   1
 
#define XXH_ALLOC_TAG   0x32485858
 
#define XXH_STATIC_LINKING_ONLY
 
#define INLINE_KEYWORD
 
#define FORCE_INLINE_ATTR
 
#define FORCE_INLINE_TEMPLATE   static INLINE_KEYWORD FORCE_INLINE_ATTR
 
#define MEM_MODULE
 
#define GCC_VERSION   (__GNUC__ * 100 + __GNUC_MINOR__)
 
#define XXH_rotl32(x, r)   ((x << r) | (x >> (32 - r)))
 
#define XXH_rotl64(x, r)   ((x << r) | (x >> (64 - r)))
 
#define XXH_CPU_LITTLE_ENDIAN   (*(const char*)(&g_one))
 
#define XXH_STATIC_ASSERT(c)   { enum { XXH_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */
 
#define XXH_get32bits(p)   XXH_readLE32_align(p, endian, align)
 
#define XXH_get64bits(p)   XXH_readLE64_align(p, endian, align)
 

Typedefs

typedef unsigned char BYTE
 
typedef unsigned short U16
 
typedef unsigned int U32
 
typedef signed int S32
 
typedef unsigned long long U64
 

Enumerations

enum  XXH_endianess { XXH_bigEndian =0, XXH_littleEndian =1 }
 
enum  XXH_alignment { XXH_aligned, XXH_unaligned }
 

Functions

static voidXXH_malloc (size_t s)
 
static void XXH_free (void *p)
 
static voidXXH_memcpy (void *dest, const void *src, size_t size)
 
static U32 XXH_read32 (const void *memPtr)
 
static U64 XXH_read64 (const void *memPtr)
 
static U32 XXH_swap32 (U32 x)
 
static U64 XXH_swap64 (U64 x)
 
FORCE_INLINE_TEMPLATE U32 XXH_readLE32_align (const void *ptr, XXH_endianess endian, XXH_alignment align)
 
FORCE_INLINE_TEMPLATE U32 XXH_readLE32 (const void *ptr, XXH_endianess endian)
 
static U32 XXH_readBE32 (const void *ptr)
 
FORCE_INLINE_TEMPLATE U64 XXH_readLE64_align (const void *ptr, XXH_endianess endian, XXH_alignment align)
 
FORCE_INLINE_TEMPLATE U64 XXH_readLE64 (const void *ptr, XXH_endianess endian)
 
static U64 XXH_readBE64 (const void *ptr)
 
XXH_PUBLIC_API unsigned XXH_versionNumber (void)
 
XXH_PUBLIC_API void XXH32_copyState (XXH32_state_t *restrict dstState, const XXH32_state_t *restrict srcState)
 
XXH_PUBLIC_API void XXH64_copyState (XXH64_state_t *restrict dstState, const XXH64_state_t *restrict srcState)
 
static U32 XXH32_round (U32 seed, U32 input)
 
FORCE_INLINE_TEMPLATE U32 XXH32_endian_align (const void *input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align)
 
XXH_PUBLIC_API unsigned int XXH32 (const void *input, size_t len, unsigned int seed)
 
static U64 XXH64_round (U64 acc, U64 input)
 
static U64 XXH64_mergeRound (U64 acc, U64 val)
 
FORCE_INLINE_TEMPLATE U64 XXH64_endian_align (const void *input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align)
 
XXH_PUBLIC_API unsigned long long XXH64 (const void *input, size_t len, unsigned long long seed)
 
XXH_PUBLIC_API XXH32_state_tXXH32_createState (void)
 
XXH_PUBLIC_API XXH_errorcode XXH32_freeState (XXH32_state_t *statePtr)
 
XXH_PUBLIC_API XXH64_state_tXXH64_createState (void)
 
XXH_PUBLIC_API XXH_errorcode XXH64_freeState (XXH64_state_t *statePtr)
 
XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t *statePtr, unsigned int seed)
 
XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t *statePtr, unsigned long long seed)
 
FORCE_INLINE_TEMPLATE XXH_errorcode XXH32_update_endian (XXH32_state_t *state, const void *input, size_t len, XXH_endianess endian)
 
XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t *state_in, const void *input, size_t len)
 
FORCE_INLINE_TEMPLATE U32 XXH32_digest_endian (const XXH32_state_t *state, XXH_endianess endian)
 
XXH_PUBLIC_API unsigned int XXH32_digest (const XXH32_state_t *state_in)
 
FORCE_INLINE_TEMPLATE XXH_errorcode XXH64_update_endian (XXH64_state_t *state, const void *input, size_t len, XXH_endianess endian)
 
XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t *state_in, const void *input, size_t len)
 
FORCE_INLINE_TEMPLATE U64 XXH64_digest_endian (const XXH64_state_t *state, XXH_endianess endian)
 
XXH_PUBLIC_API unsigned long long XXH64_digest (const XXH64_state_t *state_in)
 
XXH_PUBLIC_API void XXH32_canonicalFromHash (XXH32_canonical_t *dst, XXH32_hash_t hash)
 
XXH_PUBLIC_API void XXH64_canonicalFromHash (XXH64_canonical_t *dst, XXH64_hash_t hash)
 
XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical (const XXH32_canonical_t *src)
 
XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical (const XXH64_canonical_t *src)
 

Variables

static const int g_one = 1
 
static const U32 PRIME32_1 = 2654435761U
 
static const U32 PRIME32_2 = 2246822519U
 
static const U32 PRIME32_3 = 3266489917U
 
static const U32 PRIME32_4 = 668265263U
 
static const U32 PRIME32_5 = 374761393U
 
static const U64 PRIME64_1 = 11400714785074694791ULL
 
static const U64 PRIME64_2 = 14029467366897019727ULL
 
static const U64 PRIME64_3 = 1609587929392839161ULL
 
static const U64 PRIME64_4 = 9650029242287828579ULL
 
static const U64 PRIME64_5 = 2870177450012600261ULL
 

Macro Definition Documentation

◆ FORCE_INLINE_ATTR

#define FORCE_INLINE_ATTR

Definition at line 169 of file xxhash.c.

◆ FORCE_INLINE_TEMPLATE

#define FORCE_INLINE_TEMPLATE   static INLINE_KEYWORD FORCE_INLINE_ATTR

Definition at line 172 of file xxhash.c.

◆ GCC_VERSION

#define GCC_VERSION   (__GNUC__ * 100 + __GNUC_MINOR__)

Definition at line 243 of file xxhash.c.

◆ INLINE_KEYWORD

#define INLINE_KEYWORD

Definition at line 161 of file xxhash.c.

◆ MEM_MODULE

#define MEM_MODULE

Definition at line 184 of file xxhash.c.

◆ XXH_ALLOC_TAG

#define XXH_ALLOC_TAG   0x32485858

Definition at line 113 of file xxhash.c.

◆ XXH_CPU_LITTLE_ENDIAN

#define XXH_CPU_LITTLE_ENDIAN   (*(const char*)(&g_one))

Definition at line 290 of file xxhash.c.

◆ XXH_FORCE_ALIGN_CHECK

#define XXH_FORCE_ALIGN_CHECK   1

XXH_FORCE_ALIGN_CHECK : This is a minor performance trick, only useful with lots of very small keys. It means : check for aligned/unaligned input. The check costs one initial branch per hash; set to 0 when the input data is guaranteed to be aligned.

Definition at line 90 of file xxhash.c.

◆ XXH_FORCE_NATIVE_FORMAT

#define XXH_FORCE_NATIVE_FORMAT   0

XXH_FORCE_MEMORY_ACCESS : By default, access to unaligned memory is controlled by memcpy(), which is safe and portable. Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. The below switch allow to select different access method for improved performance. Method 0 (default) : use memcpy(). Safe and portable. Method 1 : __packed statement. It depends on compiler extension (ie, not portable). This method is safe if your compiler supports it, and generally as fast or faster than memcpy. Method 2 : direct access. This method doesn't depend on compiler but violate C standard. It can generate buggy code on targets which do not support unaligned memory accesses. But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) See http://stackoverflow.com/a/32095106/646947 for details. Prefer these methods in priority order (0 > 1 > 2)

XXH_ACCEPT_NULL_INPUT_POINTER : If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer. When this option is enabled, xxHash output for null input pointers will be the same as a null-length input. By default, this option is disabled. To enable it, uncomment below define :

XXH_FORCE_NATIVE_FORMAT : By default, xxHash library provides endian-independant Hash values, based on little-endian convention. Results are therefore identical for little-endian and big-endian CPU. This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. Should endian-independance be of no importance for your application, you may set the define below to 1, to improve speed for Big-endian CPU. This option has no impact on Little_Endian CPU.

Definition at line 77 of file xxhash.c.

◆ XXH_get32bits

#define XXH_get32bits (   p)    XXH_readLE32_align(p, endian, align)

◆ XXH_get64bits

#define XXH_get64bits (   p)    XXH_readLE64_align(p, endian, align)

◆ XXH_rotl32

#define XXH_rotl32 (   x,
  r 
)    ((x << r) | (x >> (32 - r)))

Definition at line 250 of file xxhash.c.

◆ XXH_rotl64

#define XXH_rotl64 (   x,
  r 
)    ((x << r) | (x >> (64 - r)))

Definition at line 251 of file xxhash.c.

◆ XXH_STATIC_ASSERT

#define XXH_STATIC_ASSERT (   c)    { enum { XXH_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */

Definition at line 339 of file xxhash.c.

◆ XXH_STATIC_LINKING_ONLY

#define XXH_STATIC_LINKING_ONLY

Definition at line 150 of file xxhash.c.

Typedef Documentation

◆ BYTE

typedef BYTE

Definition at line 193 of file xxhash.c.

◆ S32

typedef signed int S32

Definition at line 196 of file xxhash.c.

◆ U16

typedef unsigned short U16

Definition at line 194 of file xxhash.c.

◆ U32

typedef unsigned int U32

Definition at line 195 of file xxhash.c.

◆ U64

typedef unsigned long long U64

Definition at line 197 of file xxhash.c.

Enumeration Type Documentation

◆ XXH_alignment

Enumerator
XXH_aligned 
XXH_unaligned 

Definition at line 297 of file xxhash.c.

◆ XXH_endianess

Enumerator
XXH_bigEndian 
XXH_littleEndian 

Definition at line 285 of file xxhash.c.

Function Documentation

◆ XXH32()

XXH_PUBLIC_API unsigned int XXH32 ( const void input,
size_t  len,
unsigned int  seed 
)

Definition at line 443 of file xxhash.c.

444 {
445 #if 0
446  /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
447  XXH32_CREATESTATE_STATIC(state);
448  XXH32_reset(state, seed);
450  return XXH32_digest(state);
451 #else
453 
454  if (XXH_FORCE_ALIGN_CHECK) {
455  if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */
456  if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
458  else
460  } }
461 
462  if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
464  else
466 #endif
467 }
XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t *statePtr, unsigned int seed)
Definition: xxhash.c:609
XXH_PUBLIC_API XXH_errorcode XXH32_update(XXH32_state_t *state_in, const void *input, size_t len)
Definition: xxhash.c:693
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
FORCE_INLINE_TEMPLATE U32 XXH32_endian_align(const void *input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align)
Definition: xxhash.c:386
static int state
Definition: maze.c:121
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
#define XXH_FORCE_ALIGN_CHECK
Definition: xxhash.c:90
#define XXH_FORCE_NATIVE_FORMAT
Definition: xxhash.c:77
XXH_endianess
Definition: xxhash.c:285
XXH_PUBLIC_API unsigned int XXH32_digest(const XXH32_state_t *state_in)
Definition: xxhash.c:741

◆ XXH32_canonicalFromHash()

XXH_PUBLIC_API void XXH32_canonicalFromHash ( XXH32_canonical_t dst,
XXH32_hash_t  hash 
)

Default XXH result types are basic unsigned 32 and 64 bits. The canonical representation follows human-readable write convention, aka big-endian (large digits first). These functions allow transformation of hash result into and from its canonical format. This way, hash values can be written into a file or buffer, and remain comparable across different systems and programs.

Definition at line 895 of file xxhash.c.

896 {
899  memcpy(dst, &hash, sizeof(*dst));
900 }
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
unsigned int XXH32_hash_t
Definition: xxhash.h:160
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define XXH_STATIC_ASSERT(c)
Definition: xxhash.c:339
GLenum GLenum dst
Definition: glext.h:6340
static U32 XXH_swap32(U32 x)
Definition: xxhash.c:261
Definition: _hash_fun.h:40

◆ XXH32_copyState()

XXH_PUBLIC_API void XXH32_copyState ( XXH32_state_t *restrict  dstState,
const XXH32_state_t *restrict  srcState 
)

Definition at line 363 of file xxhash.c.

364 {
365  memcpy(dstState, srcState, sizeof(*dstState));
366 }
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ XXH32_createState()

XXH_PUBLIC_API XXH32_state_t* XXH32_createState ( void  )

State allocation, compatible with dynamic libraries

Definition at line 586 of file xxhash.c.

587 {
588  return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t));
589 }
static void * XXH_malloc(size_t s)
Definition: xxhash.c:115
struct XXH32_state_s XXH32_state_t
Definition: xxhash.h:182

◆ XXH32_digest()

XXH_PUBLIC_API unsigned int XXH32_digest ( const XXH32_state_t state_in)

Definition at line 741 of file xxhash.c.

742 {
744 
745  if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
746  return XXH32_digest_endian(state_in, XXH_littleEndian);
747  else
748  return XXH32_digest_endian(state_in, XXH_bigEndian);
749 }
FORCE_INLINE_TEMPLATE U32 XXH32_digest_endian(const XXH32_state_t *state, XXH_endianess endian)
Definition: xxhash.c:705
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
#define XXH_FORCE_NATIVE_FORMAT
Definition: xxhash.c:77
XXH_endianess
Definition: xxhash.c:285

Referenced by XXH32().

◆ XXH32_digest_endian()

FORCE_INLINE_TEMPLATE U32 XXH32_digest_endian ( const XXH32_state_t state,
XXH_endianess  endian 
)

Definition at line 705 of file xxhash.c.

706 {
707  const BYTE * p = (const BYTE*)state->mem32;
708  const BYTE* const bEnd = (const BYTE*)(state->mem32) + state->memsize;
709  U32 h32;
710 
711  if (state->large_len) {
712  h32 = XXH_rotl32(state->v1, 1) + XXH_rotl32(state->v2, 7) + XXH_rotl32(state->v3, 12) + XXH_rotl32(state->v4, 18);
713  } else {
714  h32 = state->v3 /* == seed */ + PRIME32_5;
715  }
716 
717  h32 += state->total_len_32;
718 
719  while (p+4<=bEnd) {
720  h32 += XXH_readLE32(p, endian) * PRIME32_3;
721  h32 = XXH_rotl32(h32, 17) * PRIME32_4;
722  p+=4;
723  }
724 
725  while (p<bEnd) {
726  h32 += (*p) * PRIME32_5;
727  h32 = XXH_rotl32(h32, 11) * PRIME32_1;
728  p++;
729  }
730 
731  h32 ^= h32 >> 15;
732  h32 *= PRIME32_2;
733  h32 ^= h32 >> 13;
734  h32 *= PRIME32_3;
735  h32 ^= h32 >> 16;
736 
737  return h32;
738 }
static const U32 PRIME32_5
Definition: xxhash.c:349
static const U32 PRIME32_3
Definition: xxhash.c:347
static const U32 PRIME32_1
Definition: xxhash.c:345
#define XXH_rotl32(x, r)
Definition: xxhash.c:250
static const U32 PRIME32_2
Definition: xxhash.c:346
if(!(yy_init))
Definition: macro.lex.yy.c:714
static int state
Definition: maze.c:121
unsigned char BYTE
Definition: xxhash.c:193
FORCE_INLINE_TEMPLATE U32 XXH_readLE32(const void *ptr, XXH_endianess endian)
Definition: xxhash.c:307
static const U32 PRIME32_4
Definition: xxhash.c:348
GLfloat GLfloat p
Definition: glext.h:8902
unsigned int U32
Definition: xxhash.c:195

Referenced by XXH32_digest().

◆ XXH32_endian_align()

FORCE_INLINE_TEMPLATE U32 XXH32_endian_align ( const void input,
size_t  len,
U32  seed,
XXH_endianess  endian,
XXH_alignment  align 
)

Definition at line 386 of file xxhash.c.

387 {
388  const BYTE* p = (const BYTE*)input;
389  const BYTE* bEnd = p + len;
390  U32 h32;
391 #define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
392 
393 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER
394  if (p==NULL) {
395  len=0;
396  bEnd=p=(const BYTE*)(size_t)16;
397  }
398 #endif
399 
400  if (len>=16) {
401  const BYTE* const limit = bEnd - 16;
402  U32 v1 = seed + PRIME32_1 + PRIME32_2;
403  U32 v2 = seed + PRIME32_2;
404  U32 v3 = seed + 0;
405  U32 v4 = seed - PRIME32_1;
406 
407  do {
408  v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4;
409  v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4;
410  v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4;
411  v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4;
412  } while (p<=limit);
413 
414  h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
415  } else {
416  h32 = seed + PRIME32_5;
417  }
418 
419  h32 += (U32) len;
420 
421  while (p+4<=bEnd) {
422  h32 += XXH_get32bits(p) * PRIME32_3;
423  h32 = XXH_rotl32(h32, 17) * PRIME32_4 ;
424  p+=4;
425  }
426 
427  while (p<bEnd) {
428  h32 += (*p) * PRIME32_5;
429  h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
430  p++;
431  }
432 
433  h32 ^= h32 >> 15;
434  h32 *= PRIME32_2;
435  h32 ^= h32 >> 13;
436  h32 *= PRIME32_3;
437  h32 ^= h32 >> 16;
438 
439  return h32;
440 }
static U32 XXH32_round(U32 seed, U32 input)
Definition: xxhash.c:378
static const U32 PRIME32_5
Definition: xxhash.c:349
GLint limit
Definition: glext.h:10326
static const U32 PRIME32_3
Definition: xxhash.c:347
static const U32 PRIME32_1
Definition: xxhash.c:345
smooth NULL
Definition: ftsmooth.c:416
#define XXH_rotl32(x, r)
Definition: xxhash.c:250
static const U32 PRIME32_2
Definition: xxhash.c:346
#define XXH_get32bits(p)
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat GLfloat GLfloat v3
Definition: glext.h:6064
unsigned char BYTE
Definition: xxhash.c:193
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLenum GLenum GLenum input
Definition: glext.h:9031
static const U32 PRIME32_4
Definition: xxhash.c:348
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat GLfloat v1
Definition: glext.h:6062
unsigned int U32
Definition: xxhash.c:195

Referenced by XXH32().

◆ XXH32_freeState()

XXH_PUBLIC_API XXH_errorcode XXH32_freeState ( XXH32_state_t statePtr)

Definition at line 590 of file xxhash.c.

591 {
592  XXH_free(statePtr);
593  return XXH_OK;
594 }
static void XXH_free(void *p)
Definition: xxhash.c:119
Definition: xxhash.h:79

◆ XXH32_hashFromCanonical()

XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical ( const XXH32_canonical_t src)

Definition at line 909 of file xxhash.c.

910 {
911  return XXH_readBE32(src);
912 }
static U32 XXH_readBE32(const void *ptr)
Definition: xxhash.c:312
GLenum src
Definition: glext.h:6340

◆ XXH32_reset()

XXH_PUBLIC_API XXH_errorcode XXH32_reset ( XXH32_state_t statePtr,
unsigned int  seed 
)

Definition at line 609 of file xxhash.c.

610 {
611  XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
612  memset(&state, 0, sizeof(state)-4); /* do not write into reserved, for future removal */
613  state.v1 = seed + PRIME32_1 + PRIME32_2;
614  state.v2 = seed + PRIME32_2;
615  state.v3 = seed + 0;
616  state.v4 = seed - PRIME32_1;
617  memcpy(statePtr, &state, sizeof(state));
618  return XXH_OK;
619 }
static const U32 PRIME32_1
Definition: xxhash.c:345
static const U32 PRIME32_2
Definition: xxhash.c:346
static int state
Definition: maze.c:121
Definition: xxhash.h:79
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct XXH32_state_s XXH32_state_t
Definition: xxhash.h:182
#define memset(x, y, z)
Definition: compat.h:39

Referenced by XXH32().

◆ XXH32_round()

static U32 XXH32_round ( U32  seed,
U32  input 
)
static

Definition at line 378 of file xxhash.c.

379 {
380  seed += input * PRIME32_2;
381  seed = XXH_rotl32(seed, 13);
382  seed *= PRIME32_1;
383  return seed;
384 }
static const U32 PRIME32_1
Definition: xxhash.c:345
#define XXH_rotl32(x, r)
Definition: xxhash.c:250
static const U32 PRIME32_2
Definition: xxhash.c:346
GLenum GLenum GLenum input
Definition: glext.h:9031

Referenced by XXH32_endian_align(), and XXH32_update_endian().

◆ XXH32_update()

XXH_PUBLIC_API XXH_errorcode XXH32_update ( XXH32_state_t state_in,
const void input,
size_t  len 
)

Definition at line 693 of file xxhash.c.

694 {
696 
697  if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
698  return XXH32_update_endian(state_in, input, len, XXH_littleEndian);
699  else
700  return XXH32_update_endian(state_in, input, len, XXH_bigEndian);
701 }
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
#define XXH_FORCE_NATIVE_FORMAT
Definition: xxhash.c:77
XXH_endianess
Definition: xxhash.c:285
FORCE_INLINE_TEMPLATE XXH_errorcode XXH32_update_endian(XXH32_state_t *state, const void *input, size_t len, XXH_endianess endian)
Definition: xxhash.c:635

Referenced by XXH32().

◆ XXH32_update_endian()

FORCE_INLINE_TEMPLATE XXH_errorcode XXH32_update_endian ( XXH32_state_t state,
const void input,
size_t  len,
XXH_endianess  endian 
)

Definition at line 635 of file xxhash.c.

636 {
637  const BYTE* p = (const BYTE*)input;
638  const BYTE* const bEnd = p + len;
639 
640 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER
641  if (input==NULL) return XXH_ERROR;
642 #endif
643 
644  state->total_len_32 += (unsigned)len;
645  state->large_len |= (len>=16) | (state->total_len_32>=16);
646 
647  if (state->memsize + len < 16) { /* fill in tmp buffer */
648  XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len);
649  state->memsize += (unsigned)len;
650  return XXH_OK;
651  }
652 
653  if (state->memsize) { /* some data left from previous update */
654  XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
655  { const U32* p32 = state->mem32;
656  state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++;
657  state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++;
658  state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++;
659  state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian)); p32++;
660  }
661  p += 16-state->memsize;
662  state->memsize = 0;
663  }
664 
665  if (p <= bEnd-16) {
666  const BYTE* const limit = bEnd - 16;
667  U32 v1 = state->v1;
668  U32 v2 = state->v2;
669  U32 v3 = state->v3;
670  U32 v4 = state->v4;
671 
672  do {
673  v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4;
674  v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4;
675  v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4;
676  v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4;
677  } while (p<=limit);
678 
679  state->v1 = v1;
680  state->v2 = v2;
681  state->v3 = v3;
682  state->v4 = v4;
683  }
684 
685  if (p < bEnd) {
686  XXH_memcpy(state->mem32, p, (size_t)(bEnd-p));
687  state->memsize = (unsigned)(bEnd-p);
688  }
689 
690  return XXH_OK;
691 }
static U32 XXH32_round(U32 seed, U32 input)
Definition: xxhash.c:378
GLint limit
Definition: glext.h:10326
smooth NULL
Definition: ftsmooth.c:416
static void * XXH_memcpy(void *dest, const void *src, size_t size)
Definition: xxhash.c:147
static int state
Definition: maze.c:121
Definition: xxhash.h:79
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat GLfloat GLfloat v3
Definition: glext.h:6064
unsigned char BYTE
Definition: xxhash.c:193
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLenum GLenum GLenum input
Definition: glext.h:9031
FORCE_INLINE_TEMPLATE U32 XXH_readLE32(const void *ptr, XXH_endianess endian)
Definition: xxhash.c:307
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat GLfloat v1
Definition: glext.h:6062
unsigned int U32
Definition: xxhash.c:195
static unsigned(__cdecl *hash_bstr)(bstr_t s)

Referenced by XXH32_update().

◆ XXH64()

XXH_PUBLIC_API unsigned long long XXH64 ( const void input,
size_t  len,
unsigned long long  seed 
)

Definition at line 555 of file xxhash.c.

556 {
557 #if 0
558  /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
559  XXH64_CREATESTATE_STATIC(state);
560  XXH64_reset(state, seed);
562  return XXH64_digest(state);
563 #else
565 
566  if (XXH_FORCE_ALIGN_CHECK) {
567  if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */
568  if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
570  else
572  } }
573 
574  if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
576  else
578 #endif
579 }
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
FORCE_INLINE_TEMPLATE U64 XXH64_endian_align(const void *input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align)
Definition: xxhash.c:486
XXH_PUBLIC_API unsigned long long XXH64_digest(const XXH64_state_t *state_in)
Definition: xxhash.c:874
XXH_PUBLIC_API XXH_errorcode XXH64_update(XXH64_state_t *state_in, const void *input, size_t len)
Definition: xxhash.c:810
static int state
Definition: maze.c:121
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
#define XXH_FORCE_ALIGN_CHECK
Definition: xxhash.c:90
XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t *statePtr, unsigned long long seed)
Definition: xxhash.c:622
#define XXH_FORCE_NATIVE_FORMAT
Definition: xxhash.c:77
XXH_endianess
Definition: xxhash.c:285

Referenced by calc_superblock_checksum(), calc_thread_main(), calc_tree_checksum(), check_sector_csum(), check_superblock_checksum(), check_tree_checksum(), get_sector_csum(), and get_tree_checksum().

◆ XXH64_canonicalFromHash()

XXH_PUBLIC_API void XXH64_canonicalFromHash ( XXH64_canonical_t dst,
XXH64_hash_t  hash 
)

Definition at line 902 of file xxhash.c.

903 {
906  memcpy(dst, &hash, sizeof(*dst));
907 }
static U64 XXH_swap64(U64 x)
Definition: xxhash.c:268
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
unsigned long long XXH64_hash_t
Definition: xxhash.h:161
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define XXH_STATIC_ASSERT(c)
Definition: xxhash.c:339
GLenum GLenum dst
Definition: glext.h:6340
Definition: _hash_fun.h:40

◆ XXH64_copyState()

XXH_PUBLIC_API void XXH64_copyState ( XXH64_state_t *restrict  dstState,
const XXH64_state_t *restrict  srcState 
)

Definition at line 368 of file xxhash.c.

369 {
370  memcpy(dstState, srcState, sizeof(*dstState));
371 }
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ XXH64_createState()

XXH_PUBLIC_API XXH64_state_t* XXH64_createState ( void  )

Definition at line 596 of file xxhash.c.

597 {
598  return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t));
599 }
struct XXH64_state_s XXH64_state_t
Definition: xxhash.h:183
static void * XXH_malloc(size_t s)
Definition: xxhash.c:115

◆ XXH64_digest()

XXH_PUBLIC_API unsigned long long XXH64_digest ( const XXH64_state_t state_in)

Definition at line 874 of file xxhash.c.

875 {
877 
878  if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
879  return XXH64_digest_endian(state_in, XXH_littleEndian);
880  else
881  return XXH64_digest_endian(state_in, XXH_bigEndian);
882 }
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
FORCE_INLINE_TEMPLATE U64 XXH64_digest_endian(const XXH64_state_t *state, XXH_endianess endian)
Definition: xxhash.c:822
#define XXH_FORCE_NATIVE_FORMAT
Definition: xxhash.c:77
XXH_endianess
Definition: xxhash.c:285

Referenced by XXH64(), ZSTD_decompressContinue(), ZSTD_decompressFrame(), and ZSTD_writeEpilogue().

◆ XXH64_digest_endian()

FORCE_INLINE_TEMPLATE U64 XXH64_digest_endian ( const XXH64_state_t state,
XXH_endianess  endian 
)

Definition at line 822 of file xxhash.c.

823 {
824  const BYTE * p = (const BYTE*)state->mem64;
825  const BYTE* const bEnd = (const BYTE*)state->mem64 + state->memsize;
826  U64 h64;
827 
828  if (state->total_len >= 32) {
829  U64 const v1 = state->v1;
830  U64 const v2 = state->v2;
831  U64 const v3 = state->v3;
832  U64 const v4 = state->v4;
833 
834  h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18);
835  h64 = XXH64_mergeRound(h64, v1);
836  h64 = XXH64_mergeRound(h64, v2);
837  h64 = XXH64_mergeRound(h64, v3);
838  h64 = XXH64_mergeRound(h64, v4);
839  } else {
840  h64 = state->v3 + PRIME64_5;
841  }
842 
843  h64 += (U64) state->total_len;
844 
845  while (p+8<=bEnd) {
846  U64 const k1 = XXH64_round(0, XXH_readLE64(p, endian));
847  h64 ^= k1;
848  h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4;
849  p+=8;
850  }
851 
852  if (p+4<=bEnd) {
853  h64 ^= (U64)(XXH_readLE32(p, endian)) * PRIME64_1;
854  h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3;
855  p+=4;
856  }
857 
858  while (p<bEnd) {
859  h64 ^= (*p) * PRIME64_5;
860  h64 = XXH_rotl64(h64, 11) * PRIME64_1;
861  p++;
862  }
863 
864  h64 ^= h64 >> 33;
865  h64 *= PRIME64_2;
866  h64 ^= h64 >> 29;
867  h64 *= PRIME64_3;
868  h64 ^= h64 >> 32;
869 
870  return h64;
871 }
#define XXH_rotl64(x, r)
Definition: xxhash.c:251
static U64 XXH64_round(U64 acc, U64 input)
Definition: xxhash.c:470
static const U64 PRIME64_2
Definition: xxhash.c:352
while(1)
Definition: macro.lex.yy.c:740
static U64 XXH64_mergeRound(U64 acc, U64 val)
Definition: xxhash.c:478
static const U64 PRIME64_4
Definition: xxhash.c:354
static const U64 PRIME64_1
Definition: xxhash.c:351
static const U64 PRIME64_3
Definition: xxhash.c:353
static int state
Definition: maze.c:121
GLfloat GLfloat GLfloat GLfloat v3
Definition: glext.h:6064
unsigned char BYTE
Definition: xxhash.c:193
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
unsigned long long U64
Definition: xxhash.c:197
FORCE_INLINE_TEMPLATE U32 XXH_readLE32(const void *ptr, XXH_endianess endian)
Definition: xxhash.c:307
static const U64 PRIME64_5
Definition: xxhash.c:355
FORCE_INLINE_TEMPLATE U64 XXH_readLE64(const void *ptr, XXH_endianess endian)
Definition: xxhash.c:325
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat GLfloat v1
Definition: glext.h:6062

Referenced by XXH64_digest().

◆ XXH64_endian_align()

FORCE_INLINE_TEMPLATE U64 XXH64_endian_align ( const void input,
size_t  len,
U64  seed,
XXH_endianess  endian,
XXH_alignment  align 
)

Definition at line 486 of file xxhash.c.

487 {
488  const BYTE* p = (const BYTE*)input;
489  const BYTE* const bEnd = p + len;
490  U64 h64;
491 #define XXH_get64bits(p) XXH_readLE64_align(p, endian, align)
492 
493 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER
494  if (p==NULL) {
495  len=0;
496  bEnd=p=(const BYTE*)(size_t)32;
497  }
498 #endif
499 
500  if (len>=32) {
501  const BYTE* const limit = bEnd - 32;
502  U64 v1 = seed + PRIME64_1 + PRIME64_2;
503  U64 v2 = seed + PRIME64_2;
504  U64 v3 = seed + 0;
505  U64 v4 = seed - PRIME64_1;
506 
507  do {
508  v1 = XXH64_round(v1, XXH_get64bits(p)); p+=8;
509  v2 = XXH64_round(v2, XXH_get64bits(p)); p+=8;
510  v3 = XXH64_round(v3, XXH_get64bits(p)); p+=8;
511  v4 = XXH64_round(v4, XXH_get64bits(p)); p+=8;
512  } while (p<=limit);
513 
514  h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18);
515  h64 = XXH64_mergeRound(h64, v1);
516  h64 = XXH64_mergeRound(h64, v2);
517  h64 = XXH64_mergeRound(h64, v3);
518  h64 = XXH64_mergeRound(h64, v4);
519 
520  } else {
521  h64 = seed + PRIME64_5;
522  }
523 
524  h64 += (U64) len;
525 
526  while (p+8<=bEnd) {
527  U64 const k1 = XXH64_round(0, XXH_get64bits(p));
528  h64 ^= k1;
529  h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4;
530  p+=8;
531  }
532 
533  if (p+4<=bEnd) {
534  h64 ^= (U64)(XXH_get32bits(p)) * PRIME64_1;
535  h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3;
536  p+=4;
537  }
538 
539  while (p<bEnd) {
540  h64 ^= (*p) * PRIME64_5;
541  h64 = XXH_rotl64(h64, 11) * PRIME64_1;
542  p++;
543  }
544 
545  h64 ^= h64 >> 33;
546  h64 *= PRIME64_2;
547  h64 ^= h64 >> 29;
548  h64 *= PRIME64_3;
549  h64 ^= h64 >> 32;
550 
551  return h64;
552 }
#define XXH_rotl64(x, r)
Definition: xxhash.c:251
static U64 XXH64_round(U64 acc, U64 input)
Definition: xxhash.c:470
GLint limit
Definition: glext.h:10326
static const U64 PRIME64_2
Definition: xxhash.c:352
static U64 XXH64_mergeRound(U64 acc, U64 val)
Definition: xxhash.c:478
smooth NULL
Definition: ftsmooth.c:416
#define XXH_get64bits(p)
#define XXH_get32bits(p)
static const U64 PRIME64_4
Definition: xxhash.c:354
static const U64 PRIME64_1
Definition: xxhash.c:351
static const U64 PRIME64_3
Definition: xxhash.c:353
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat GLfloat GLfloat v3
Definition: glext.h:6064
unsigned char BYTE
Definition: xxhash.c:193
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLenum GLenum GLenum input
Definition: glext.h:9031
unsigned long long U64
Definition: xxhash.c:197
static const U64 PRIME64_5
Definition: xxhash.c:355
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat GLfloat v1
Definition: glext.h:6062

Referenced by XXH64().

◆ XXH64_freeState()

XXH_PUBLIC_API XXH_errorcode XXH64_freeState ( XXH64_state_t statePtr)

Definition at line 600 of file xxhash.c.

601 {
602  XXH_free(statePtr);
603  return XXH_OK;
604 }
static void XXH_free(void *p)
Definition: xxhash.c:119
Definition: xxhash.h:79

◆ XXH64_hashFromCanonical()

XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical ( const XXH64_canonical_t src)

Definition at line 914 of file xxhash.c.

915 {
916  return XXH_readBE64(src);
917 }
static U64 XXH_readBE64(const void *ptr)
Definition: xxhash.c:330
GLenum src
Definition: glext.h:6340

◆ XXH64_mergeRound()

static U64 XXH64_mergeRound ( U64  acc,
U64  val 
)
static

Definition at line 478 of file xxhash.c.

479 {
480  val = XXH64_round(0, val);
481  acc ^= val;
482  acc = acc * PRIME64_1 + PRIME64_4;
483  return acc;
484 }
static U64 XXH64_round(U64 acc, U64 input)
Definition: xxhash.c:470
GLuint GLfloat * val
Definition: glext.h:7180
static const U64 PRIME64_4
Definition: xxhash.c:354
static const U64 PRIME64_1
Definition: xxhash.c:351

Referenced by XXH64_digest_endian(), and XXH64_endian_align().

◆ XXH64_reset()

XXH_PUBLIC_API XXH_errorcode XXH64_reset ( XXH64_state_t statePtr,
unsigned long long  seed 
)

Definition at line 622 of file xxhash.c.

623 {
624  XXH64_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
625  memset(&state, 0, sizeof(state)-8); /* do not write into reserved, for future removal */
626  state.v1 = seed + PRIME64_1 + PRIME64_2;
627  state.v2 = seed + PRIME64_2;
628  state.v3 = seed + 0;
629  state.v4 = seed - PRIME64_1;
630  memcpy(statePtr, &state, sizeof(state));
631  return XXH_OK;
632 }
struct XXH64_state_s XXH64_state_t
Definition: xxhash.h:183
static const U64 PRIME64_2
Definition: xxhash.c:352
static const U64 PRIME64_1
Definition: xxhash.c:351
static int state
Definition: maze.c:121
Definition: xxhash.h:79
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memset(x, y, z)
Definition: compat.h:39

Referenced by XXH64(), ZSTD_continueCCtx(), ZSTD_decodeFrameHeader(), and ZSTD_resetCCtx_internal().

◆ XXH64_round()

static U64 XXH64_round ( U64  acc,
U64  input 
)
static

Definition at line 470 of file xxhash.c.

471 {
472  acc += input * PRIME64_2;
473  acc = XXH_rotl64(acc, 31);
474  acc *= PRIME64_1;
475  return acc;
476 }
#define XXH_rotl64(x, r)
Definition: xxhash.c:251
static const U64 PRIME64_2
Definition: xxhash.c:352
static const U64 PRIME64_1
Definition: xxhash.c:351
GLenum GLenum GLenum input
Definition: glext.h:9031

Referenced by XXH64_digest_endian(), XXH64_endian_align(), XXH64_mergeRound(), and XXH64_update_endian().

◆ XXH64_update()

XXH_PUBLIC_API XXH_errorcode XXH64_update ( XXH64_state_t state_in,
const void input,
size_t  len 
)

Definition at line 810 of file xxhash.c.

811 {
813 
814  if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
815  return XXH64_update_endian(state_in, input, len, XXH_littleEndian);
816  else
817  return XXH64_update_endian(state_in, input, len, XXH_bigEndian);
818 }
FORCE_INLINE_TEMPLATE XXH_errorcode XXH64_update_endian(XXH64_state_t *state, const void *input, size_t len, XXH_endianess endian)
Definition: xxhash.c:755
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
#define XXH_FORCE_NATIVE_FORMAT
Definition: xxhash.c:77
XXH_endianess
Definition: xxhash.c:285

Referenced by XXH64(), ZSTD_compress_frameChunk(), ZSTD_decompressContinue(), and ZSTD_decompressFrame().

◆ XXH64_update_endian()

FORCE_INLINE_TEMPLATE XXH_errorcode XXH64_update_endian ( XXH64_state_t state,
const void input,
size_t  len,
XXH_endianess  endian 
)

Definition at line 755 of file xxhash.c.

756 {
757  const BYTE* p = (const BYTE*)input;
758  const BYTE* const bEnd = p + len;
759 
760 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER
761  if (input==NULL) return XXH_ERROR;
762 #endif
763 
764  state->total_len += len;
765 
766  if (state->memsize + len < 32) { /* fill in tmp buffer */
767  XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, len);
768  state->memsize += (U32)len;
769  return XXH_OK;
770  }
771 
772  if (state->memsize) { /* tmp buffer is full */
773  XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, 32-state->memsize);
774  state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0, endian));
775  state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1, endian));
776  state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2, endian));
777  state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3, endian));
778  p += 32-state->memsize;
779  state->memsize = 0;
780  }
781 
782  if (p+32 <= bEnd) {
783  const BYTE* const limit = bEnd - 32;
784  U64 v1 = state->v1;
785  U64 v2 = state->v2;
786  U64 v3 = state->v3;
787  U64 v4 = state->v4;
788 
789  do {
790  v1 = XXH64_round(v1, XXH_readLE64(p, endian)); p+=8;
791  v2 = XXH64_round(v2, XXH_readLE64(p, endian)); p+=8;
792  v3 = XXH64_round(v3, XXH_readLE64(p, endian)); p+=8;
793  v4 = XXH64_round(v4, XXH_readLE64(p, endian)); p+=8;
794  } while (p<=limit);
795 
796  state->v1 = v1;
797  state->v2 = v2;
798  state->v3 = v3;
799  state->v4 = v4;
800  }
801 
802  if (p < bEnd) {
803  XXH_memcpy(state->mem64, p, (size_t)(bEnd-p));
804  state->memsize = (unsigned)(bEnd-p);
805  }
806 
807  return XXH_OK;
808 }
static U64 XXH64_round(U64 acc, U64 input)
Definition: xxhash.c:470
GLint limit
Definition: glext.h:10326
smooth NULL
Definition: ftsmooth.c:416
static void * XXH_memcpy(void *dest, const void *src, size_t size)
Definition: xxhash.c:147
static int state
Definition: maze.c:121
Definition: xxhash.h:79
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat GLfloat GLfloat v3
Definition: glext.h:6064
unsigned char BYTE
Definition: xxhash.c:193
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLenum GLenum GLenum input
Definition: glext.h:9031
unsigned long long U64
Definition: xxhash.c:197
FORCE_INLINE_TEMPLATE U64 XXH_readLE64(const void *ptr, XXH_endianess endian)
Definition: xxhash.c:325
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat GLfloat v1
Definition: glext.h:6062
unsigned int U32
Definition: xxhash.c:195
static unsigned(__cdecl *hash_bstr)(bstr_t s)

Referenced by XXH64_update().

◆ XXH_free()

static void XXH_free ( void p)
static

Definition at line 119 of file xxhash.c.

119  {
120  ExFreePool(p);
121 }
GLfloat GLfloat p
Definition: glext.h:8902
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by XXH32_freeState(), and XXH64_freeState().

◆ XXH_malloc()

static void* XXH_malloc ( size_t  s)
static

Definition at line 115 of file xxhash.c.

115  {
117 }
#define XXH_ALLOC_TAG
Definition: xxhash.c:113
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
GLdouble s
Definition: gl.h:2039

Referenced by XXH32_createState(), and XXH64_createState().

◆ XXH_memcpy()

static void* XXH_memcpy ( void dest,
const void src,
size_t  size 
)
static

Definition at line 147 of file xxhash.c.

147 { return memcpy(dest,src,size); }
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
static char * dest
Definition: rtl.c:135

Referenced by XXH32_update_endian(), and XXH64_update_endian().

◆ XXH_read32()

static U32 XXH_read32 ( const void memPtr)
static

Definition at line 223 of file xxhash.c.

224 {
225  U32 val;
226  memcpy(&val, memPtr, sizeof(val));
227  return val;
228 }
GLuint GLfloat * val
Definition: glext.h:7180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int U32
Definition: xxhash.c:195

Referenced by XXH_readBE32(), and XXH_readLE32_align().

◆ XXH_read64()

static U64 XXH_read64 ( const void memPtr)
static

Definition at line 230 of file xxhash.c.

231 {
232  U64 val;
233  memcpy(&val, memPtr, sizeof(val));
234  return val;
235 }
GLuint GLfloat * val
Definition: glext.h:7180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned long long U64
Definition: xxhash.c:197

Referenced by XXH_readBE64(), and XXH_readLE64_align().

◆ XXH_readBE32()

static U32 XXH_readBE32 ( const void ptr)
static

Definition at line 312 of file xxhash.c.

313 {
315 }
static U32 XXH_read32(const void *memPtr)
Definition: xxhash.c:223
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
static PVOID ptr
Definition: dispmode.c:27
static U32 XXH_swap32(U32 x)
Definition: xxhash.c:261

Referenced by XXH32_hashFromCanonical().

◆ XXH_readBE64()

static U64 XXH_readBE64 ( const void ptr)
static

Definition at line 330 of file xxhash.c.

331 {
333 }
static U64 XXH_swap64(U64 x)
Definition: xxhash.c:268
#define XXH_CPU_LITTLE_ENDIAN
Definition: xxhash.c:290
static U64 XXH_read64(const void *memPtr)
Definition: xxhash.c:230
static PVOID ptr
Definition: dispmode.c:27

Referenced by XXH64_hashFromCanonical().

◆ XXH_readLE32()

FORCE_INLINE_TEMPLATE U32 XXH_readLE32 ( const void ptr,
XXH_endianess  endian 
)

Definition at line 307 of file xxhash.c.

308 {
309  return XXH_readLE32_align(ptr, endian, XXH_unaligned);
310 }
static PVOID ptr
Definition: dispmode.c:27
FORCE_INLINE_TEMPLATE U32 XXH_readLE32_align(const void *ptr, XXH_endianess endian, XXH_alignment align)
Definition: xxhash.c:299

Referenced by XXH32_digest_endian(), XXH32_update_endian(), and XXH64_digest_endian().

◆ XXH_readLE32_align()

FORCE_INLINE_TEMPLATE U32 XXH_readLE32_align ( const void ptr,
XXH_endianess  endian,
XXH_alignment  align 
)

Definition at line 299 of file xxhash.c.

300 {
301  if (align==XXH_unaligned)
302  return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr));
303  else
304  return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr);
305 }
static U32 XXH_read32(const void *memPtr)
Definition: xxhash.c:223
int align(int length, int align)
Definition: dsound8.c:36
static PVOID ptr
Definition: dispmode.c:27
static U32 XXH_swap32(U32 x)
Definition: xxhash.c:261
unsigned int U32
Definition: xxhash.c:195

Referenced by XXH_readLE32().

◆ XXH_readLE64()

FORCE_INLINE_TEMPLATE U64 XXH_readLE64 ( const void ptr,
XXH_endianess  endian 
)

Definition at line 325 of file xxhash.c.

326 {
327  return XXH_readLE64_align(ptr, endian, XXH_unaligned);
328 }
FORCE_INLINE_TEMPLATE U64 XXH_readLE64_align(const void *ptr, XXH_endianess endian, XXH_alignment align)
Definition: xxhash.c:317
static PVOID ptr
Definition: dispmode.c:27

Referenced by XXH64_digest_endian(), and XXH64_update_endian().

◆ XXH_readLE64_align()

FORCE_INLINE_TEMPLATE U64 XXH_readLE64_align ( const void ptr,
XXH_endianess  endian,
XXH_alignment  align 
)

Definition at line 317 of file xxhash.c.

318 {
319  if (align==XXH_unaligned)
320  return endian==XXH_littleEndian ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr));
321  else
322  return endian==XXH_littleEndian ? *(const U64*)ptr : XXH_swap64(*(const U64*)ptr);
323 }
static U64 XXH_swap64(U64 x)
Definition: xxhash.c:268
int align(int length, int align)
Definition: dsound8.c:36
static U64 XXH_read64(const void *memPtr)
Definition: xxhash.c:230
static PVOID ptr
Definition: dispmode.c:27
unsigned long long U64
Definition: xxhash.c:197

Referenced by XXH_readLE64().

◆ XXH_swap32()

static U32 XXH_swap32 ( U32  x)
static

Definition at line 261 of file xxhash.c.

262 {
263  return ((x << 24) & 0xff000000 ) |
264  ((x << 8) & 0x00ff0000 ) |
265  ((x >> 8) & 0x0000ff00 ) |
266  ((x >> 24) & 0x000000ff );
267 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548

Referenced by XXH32_canonicalFromHash(), XXH_readBE32(), and XXH_readLE32_align().

◆ XXH_swap64()

static U64 XXH_swap64 ( U64  x)
static

Definition at line 268 of file xxhash.c.

269 {
270  return ((x << 56) & 0xff00000000000000ULL) |
271  ((x << 40) & 0x00ff000000000000ULL) |
272  ((x << 24) & 0x0000ff0000000000ULL) |
273  ((x << 8) & 0x000000ff00000000ULL) |
274  ((x >> 8) & 0x00000000ff000000ULL) |
275  ((x >> 24) & 0x0000000000ff0000ULL) |
276  ((x >> 40) & 0x000000000000ff00ULL) |
277  ((x >> 56) & 0x00000000000000ffULL);
278 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548

Referenced by XXH64_canonicalFromHash(), XXH_readBE64(), and XXH_readLE64_align().

◆ XXH_versionNumber()

XXH_PUBLIC_API unsigned XXH_versionNumber ( void  )

Definition at line 357 of file xxhash.c.

357 { return XXH_VERSION_NUMBER; }
#define XXH_VERSION_NUMBER
Definition: xxhash.h:153

Variable Documentation

◆ g_one

const int g_one = 1
static

Definition at line 289 of file xxhash.c.

◆ PRIME32_1

const U32 PRIME32_1 = 2654435761U
static

Definition at line 345 of file xxhash.c.

Referenced by XXH32_digest_endian(), XXH32_endian_align(), XXH32_reset(), and XXH32_round().

◆ PRIME32_2

const U32 PRIME32_2 = 2246822519U
static

Definition at line 346 of file xxhash.c.

Referenced by XXH32_digest_endian(), XXH32_endian_align(), XXH32_reset(), and XXH32_round().

◆ PRIME32_3

const U32 PRIME32_3 = 3266489917U
static

Definition at line 347 of file xxhash.c.

Referenced by XXH32_digest_endian(), and XXH32_endian_align().

◆ PRIME32_4

const U32 PRIME32_4 = 668265263U
static

Definition at line 348 of file xxhash.c.

Referenced by XXH32_digest_endian(), and XXH32_endian_align().

◆ PRIME32_5

const U32 PRIME32_5 = 374761393U
static

Definition at line 349 of file xxhash.c.

Referenced by XXH32_digest_endian(), and XXH32_endian_align().

◆ PRIME64_1

const U64 PRIME64_1 = 11400714785074694791ULL
static

◆ PRIME64_2

const U64 PRIME64_2 = 14029467366897019727ULL
static

Definition at line 352 of file xxhash.c.

Referenced by XXH64_digest_endian(), XXH64_endian_align(), XXH64_reset(), and XXH64_round().

◆ PRIME64_3

const U64 PRIME64_3 = 1609587929392839161ULL
static

Definition at line 353 of file xxhash.c.

Referenced by XXH64_digest_endian(), and XXH64_endian_align().

◆ PRIME64_4

const U64 PRIME64_4 = 9650029242287828579ULL
static

Definition at line 354 of file xxhash.c.

Referenced by XXH64_digest_endian(), XXH64_endian_align(), and XXH64_mergeRound().

◆ PRIME64_5

const U64 PRIME64_5 = 2870177450012600261ULL
static

Definition at line 355 of file xxhash.c.

Referenced by XXH64_digest_endian(), and XXH64_endian_align().