52 #ifndef XXH_FORCE_MEMORY_ACCESS 53 # if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) 54 # define XXH_FORCE_MEMORY_ACCESS 2 55 # elif defined(__INTEL_COMPILER) || \ 56 (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) 57 # define XXH_FORCE_MEMORY_ACCESS 1 76 #ifndef XXH_FORCE_NATIVE_FORMAT 77 # define XXH_FORCE_NATIVE_FORMAT 0 86 #ifndef XXH_FORCE_ALIGN_CHECK 87 # if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) 88 # define XXH_FORCE_ALIGN_CHECK 0 90 # define XXH_FORCE_ALIGN_CHECK 1 107 #define XXH_STATIC_LINKING_ONLY 115 # pragma warning(disable : 4127) 116 # define FORCE_INLINE static __forceinline 118 # if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 120 # define FORCE_INLINE static inline __attribute__((always_inline)) 122 # define FORCE_INLINE static inline 125 # define FORCE_INLINE static 134 # if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) ) ) 142 typedef unsigned short U16;
148 #if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) 153 #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) 157 typedef union {
U32 u32; } __attribute__((
packed)) unalign;
158 static U32 XXH_read32(
const void* ptr) {
return ((
const unalign*)ptr)->u32; }
168 memcpy(&val, memPtr,
sizeof(val));
178 #define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) 181 #if defined(_MSC_VER) 182 # define XXH_rotl32(x,r) _rotl(x,r) 183 # define XXH_rotl64(x,r) _rotl64(x,r) 185 # define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r))) 186 # define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r))) 189 #if defined(_MSC_VER) 190 # define XXH_swap32 _byteswap_ulong 191 #elif XXH_GCC_VERSION >= 403 192 # define XXH_swap32 __builtin_bswap32 196 return ((x << 24) & 0xff000000 ) |
197 ((x << 8) & 0x00ff0000 ) |
198 ((x >> 8) & 0x0000ff00 ) |
199 ((x >> 24) & 0x000000ff );
210 #ifndef XXH_CPU_LITTLE_ENDIAN 212 # define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&g_one)) 243 #define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(int)(!!(c)) }; } 269 #define XXH_get32bits(p) XXH_readLE32_align(p, endian, align) 271 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER 274 bEnd=p=(
const BYTE*)(
size_t)16;
333 if ((((
size_t)input) & 3) == 0) {
363 memcpy(dstState, srcState,
sizeof(*dstState));
369 memset(&state, 0,
sizeof(state)-4);
374 memcpy(statePtr, &state,
sizeof(state));
382 const BYTE*
const bEnd = p +
len;
384 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER 388 state->total_len_32 += (unsigned)len;
389 state->large_len |= (len>=16) | (state->total_len_32>=16);
391 if (state->memsize + len < 16) {
393 state->memsize += (unsigned)len;
397 if (state->memsize) {
398 XXH_memcpy((
BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
399 {
const U32* p32 = state->mem32;
405 p += 16-state->memsize;
430 XXH_memcpy(state->mem32, p, (
size_t)(bEnd-p));
431 state->memsize = (unsigned)(bEnd-p);
451 const BYTE *
p = (
const BYTE*)state->mem32;
452 const BYTE*
const bEnd = (
const BYTE*)(state->mem32) + state->memsize;
455 if (state->large_len) {
461 h32 += state->total_len_32;
508 memcpy(dst, &hash,
sizeof(*dst));
517 #ifndef XXH_NO_LONG_LONG 527 # if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) ) ) 531 typedef unsigned long long U64;
536 #if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) 541 #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) 546 static U64 XXH_read64(
const void* ptr) {
return ((
const unalign64*)ptr)->u64; }
557 memcpy(&val, memPtr,
sizeof(val));
563 #if defined(_MSC_VER) 564 # define XXH_swap64 _byteswap_uint64 565 #elif XXH_GCC_VERSION >= 403 566 # define XXH_swap64 __builtin_bswap64 570 return ((x << 56) & 0xff00000000000000ULL) |
571 ((x << 40) & 0x00ff000000000000ULL) |
572 ((x << 24) & 0x0000ff0000000000ULL) |
573 ((x << 8) & 0x000000ff00000000ULL) |
574 ((x >> 8) & 0x00000000ff000000ULL) |
575 ((x >> 24) & 0x0000000000ff0000ULL) |
576 ((x >> 40) & 0x000000000000ff00ULL) |
577 ((x >> 56) & 0x00000000000000ffULL);
627 const BYTE*
const bEnd = p +
len;
629 #define XXH_get64bits(p) XXH_readLE64_align(p, endian, align) 631 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER 634 bEnd=p=(
const BYTE*)(
size_t)32;
705 if ((((
size_t)input) & 7)==0) {
733 memcpy(dstState, srcState,
sizeof(*dstState));
739 memset(&state, 0,
sizeof(state)-8);
744 memcpy(statePtr, &state,
sizeof(state));
751 const BYTE*
const bEnd = p +
len;
753 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER 757 state->total_len +=
len;
759 if (state->memsize + len < 32) {
761 state->memsize += (
U32)len;
765 if (state->memsize) {
766 XXH_memcpy(((
BYTE*)state->mem64) + state->memsize, input, 32-state->memsize);
771 p += 32-state->memsize;
796 XXH_memcpy(state->mem64, p, (
size_t)(bEnd-p));
797 state->memsize = (unsigned)(bEnd-p);
815 const BYTE *
p = (
const BYTE*)state->mem64;
816 const BYTE*
const bEnd = (
const BYTE*)state->mem64 + state->memsize;
819 if (state->total_len >= 32) {
820 U64 const v1 = state->v1;
821 U64 const v2 = state->v2;
822 U64 const v3 = state->v3;
823 U64 const v4 = state->v4;
834 h64 += (
U64) state->total_len;
881 memcpy(dst, &hash,
sizeof(*dst));
static void XXH_free(void *p)
XXH_PUBLIC_API XXH_errorcode XXH64_update(XXH64_state_t *state_in, const void *input, size_t len)
#define XXH_CPU_LITTLE_ENDIAN
FORCE_INLINE U64 XXH64_digest_endian(const XXH64_state_t *state, XXH_endianess endian)
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
static const U64 PRIME64_5
static const U32 PRIME32_5
XXH_PUBLIC_API unsigned XXH_versionNumber(void)
XXH_PUBLIC_API unsigned long long XXH64_digest(const XXH64_state_t *state_in)
XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t *statePtr, unsigned int seed)
static const U32 PRIME32_2
XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t *src)
XXH_PUBLIC_API unsigned int XXH32_digest(const XXH32_state_t *state_in)
#define XXH_VERSION_NUMBER
XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t *src)
static U32 XXH_read32(const void *memPtr)
static U64 XXH_read64(const void *memPtr)
XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t *statePtr, unsigned long long seed)
struct XXH32_state_s XXH32_state_t
static U32 XXH_swap32(U32 x)
#define XXH_FORCE_ALIGN_CHECK
#define XXH_FORCE_NATIVE_FORMAT
#define XXH_STATIC_ASSERT(c)
FORCE_INLINE U64 XXH_readLE64_align(const void *ptr, XXH_endianess endian, XXH_alignment align)
FORCE_INLINE U32 XXH32_endian_align(const void *input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align)
FORCE_INLINE XXH_errorcode XXH32_update_endian(XXH32_state_t *state, const void *input, size_t len, XXH_endianess endian)
FORCE_INLINE U64 XXH_readLE64(const void *ptr, XXH_endianess endian)
static const U64 PRIME64_1
XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t *statePtr)
XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t *dstState, const XXH32_state_t *srcState)
static void * XXH_memcpy(void *dest, const void *src, size_t size)
struct XXH64_state_s XXH64_state_t
XXH_PUBLIC_API XXH64_state_t * XXH64_createState(void)
unsigned __int64 uint64_t
GLfloat GLfloat GLfloat GLfloat v3
static const U64 PRIME64_2
XXH_PUBLIC_API unsigned long long XXH64(const void *input, size_t len, unsigned long long seed)
XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t *statePtr)
unsigned long long XXH64_hash_t
static U64 XXH64_mergeRound(U64 acc, U64 val)
XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t *dstState, const XXH64_state_t *srcState)
static const U32 PRIME32_1
XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t *dst, XXH64_hash_t hash)
FORCE_INLINE U32 XXH_readLE32(const void *ptr, XXH_endianess endian)
FORCE_INLINE U32 XXH_readLE32_align(const void *ptr, XXH_endianess endian, XXH_alignment align)
GLdouble GLdouble GLint GLint GLdouble v1
static const U64 PRIME64_3
static void * XXH_malloc(size_t s)
FORCE_INLINE U32 XXH32_digest_endian(const XXH32_state_t *state, XXH_endianess endian)
GLenum GLenum GLenum input
static const U32 PRIME32_4
unsigned int XXH32_hash_t
static U32 XXH_readBE32(const void *ptr)
FORCE_INLINE U64 XXH64_endian_align(const void *input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align)
XXH_PUBLIC_API XXH32_state_t * XXH32_createState(void)
static U64 XXH64_round(U64 acc, U64 input)
XXH_PUBLIC_API XXH_errorcode XXH32_update(XXH32_state_t *state_in, const void *input, size_t len)
static U64 XXH_readBE64(const void *ptr)
XXH_PUBLIC_API unsigned int XXH32(const void *input, size_t len, unsigned int seed)
FORCE_INLINE XXH_errorcode XXH64_update_endian(XXH64_state_t *state, const void *input, size_t len, XXH_endianess endian)
static const U64 PRIME64_4
static U32 XXH32_round(U32 seed, U32 input)
static U64 XXH_swap64(U64 x)
XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t *dst, XXH32_hash_t hash)
static const U32 PRIME32_3