43#if defined(__ARM_FEATURE_UNALIGNED) || defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)
44# define XXH_USE_UNALIGNED_ACCESS 1
62#define XXH_FORCE_NATIVE_FORMAT 0
69# pragma warning(disable : 4127)
70# define FORCE_INLINE static __forceinline
72# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
74# define FORCE_INLINE static inline __attribute__((always_inline))
76# define FORCE_INLINE static inline
79# define FORCE_INLINE static
95static void*
XXH_memcpy(
void*
dest,
const void* src,
size_t size) {
return memcpy(
dest,src,size); }
101#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
103 typedef uint8_t
BYTE;
104 typedef uint16_t
U16;
105 typedef uint32_t
U32;
107 typedef uint64_t
U64;
110 typedef unsigned short U16;
113 typedef unsigned long long U64;
119 memcpy(&val32, memPtr, 4);
126 memcpy(&val64, memPtr, 8);
135#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
139# define XXH_rotl32(x,r) _rotl(x,r)
140# define XXH_rotl64(x,r) _rotl64(x,r)
142# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
143# define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r)))
147# define XXH_swap32 _byteswap_ulong
148# define XXH_swap64 _byteswap_uint64
149#elif GCC_VERSION >= 403
150# define XXH_swap32 __builtin_bswap32
151# define XXH_swap64 __builtin_bswap64
155 return ((x << 24) & 0xff000000 ) |
156 ((x << 8) & 0x00ff0000 ) |
157 ((x >> 8) & 0x0000ff00 ) |
158 ((x >> 24) & 0x000000ff );
162 return ((x << 56) & 0xff00000000000000ULL) |
163 ((x << 40) & 0x00ff000000000000ULL) |
164 ((x << 24) & 0x0000ff0000000000ULL) |
165 ((x << 8) & 0x000000ff00000000ULL) |
166 ((x >> 8) & 0x00000000ff000000ULL) |
167 ((x >> 24) & 0x0000000000ff0000ULL) |
168 ((x >> 40) & 0x000000000000ff00ULL) |
169 ((x >> 56) & 0x00000000000000ffULL);
178#ifndef XXH_CPU_LITTLE_ENDIAN
180# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&one))
219#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(!!(c)) }; }
225#define PRIME32_1 2654435761U
226#define PRIME32_2 2246822519U
227#define PRIME32_3 3266489917U
228#define PRIME32_4 668265263U
229#define PRIME32_5 374761393U
231#define PRIME64_1 11400714785074694791ULL
232#define PRIME64_2 14029467366897019727ULL
233#define PRIME64_3 1609587929392839161ULL
234#define PRIME64_4 9650029242287828579ULL
235#define PRIME64_5 2870177450012600261ULL
244 const BYTE* bEnd = p + len;
246#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
248#ifdef XXH_ACCEPT_NULL_INPUT_POINTER
252 bEnd=p=(
const BYTE*)(
size_t)16;
258 const BYTE*
const limit = bEnd - 16;
318unsigned XXH32 (
const void* input,
size_t len,
unsigned seed)
329# if !defined(XXH_USE_UNALIGNED_ACCESS)
330 if ((((
size_t)input) & 3) == 0)
349 const BYTE* bEnd = p + len;
351#define XXH_get64bits(p) XXH_readLE64_align(p, endian, align)
353#ifdef XXH_ACCEPT_NULL_INPUT_POINTER
357 bEnd=p=(
const BYTE*)(
size_t)32;
363 const BYTE*
const limit = bEnd - 32;
458unsigned long long XXH64 (
const void* input,
size_t len,
unsigned long long seed)
469# if !defined(XXH_USE_UNALIGNED_ACCESS)
470 if ((((
size_t)input) & 7)==0)
547 state->
v3 = seed + 0;
560 state->
v3 = seed + 0;
572 const BYTE*
const bEnd = p + len;
574#ifdef XXH_ACCEPT_NULL_INPUT_POINTER
615 const BYTE*
const limit = bEnd - 16;
651 state->
memsize = (int)(bEnd-p);
726 const BYTE*
const bEnd = p + len;
728#ifdef XXH_ACCEPT_NULL_INPUT_POINTER
769 const BYTE*
const limit = bEnd - 32;
805 state->
memsize = (int)(bEnd-p);
static void * XXH_malloc(size_t s)
static U64 XXH_read64(const void *memPtr)
FORCE_INLINE U32 XXH32_endian_align(const void *input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align)
FORCE_INLINE U64 XXH_readLE64(const void *ptr, XXH_endianess endian)
#define XXH_STATIC_ASSERT(c)
#define XXH_CPU_LITTLE_ENDIAN
FORCE_INLINE U64 XXH_readLE64_align(const void *ptr, XXH_endianess endian, XXH_alignment align)
FORCE_INLINE XXH_errorcode XXH64_update_endian(XXH64_state_t *state_in, const void *input, size_t len, XXH_endianess endian)
static U64 XXH_swap64(U64 x)
FORCE_INLINE U64 XXH64_digest_endian(const XXH64_state_t *state_in, XXH_endianess endian)
FORCE_INLINE U32 XXH_readLE32(const void *ptr, XXH_endianess endian)
static void XXH_free(void *p)
static U32 XXH_swap32(U32 x)
XXH32_state_t * XXH32_createState(void)
FORCE_INLINE XXH_errorcode XXH32_update_endian(XXH32_state_t *state_in, const void *input, size_t len, XXH_endianess endian)
static void * XXH_memcpy(void *dest, const void *src, size_t size)
FORCE_INLINE U32 XXH_readLE32_align(const void *ptr, XXH_endianess endian, XXH_alignment align)
static U32 XXH_read32(const void *memPtr)
XXH64_state_t * XXH64_createState(void)
FORCE_INLINE U64 XXH64_endian_align(const void *input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align)
FORCE_INLINE U32 XXH32_digest_endian(const XXH32_state_t *state_in, XXH_endianess endian)
#define XXH_FORCE_NATIVE_FORMAT