ReactOS 0.4.16-dev-88-ga65b6ae
|
#include <stdlib.h>
#include <stddef.h>
#include <ntifs.h>
#include <ntddk.h>
#include <string.h>
#include "xxhash.h"
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 } |
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 |
#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR |
#define XXH_FORCE_ALIGN_CHECK 1 |
#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.
#define XXH_get32bits | ( | p | ) | XXH_readLE32_align(p, endian, align) |
#define XXH_get64bits | ( | p | ) | XXH_readLE64_align(p, endian, align) |
Definition at line 443 of file xxhash.c.
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.
XXH_PUBLIC_API void XXH32_copyState | ( | XXH32_state_t *restrict | dstState, |
const XXH32_state_t *restrict | srcState | ||
) |
XXH_PUBLIC_API XXH32_state_t * XXH32_createState | ( | void | ) |
XXH_PUBLIC_API unsigned int XXH32_digest | ( | const XXH32_state_t * | state_in | ) |
Definition at line 741 of file xxhash.c.
Referenced by XXH32().
FORCE_INLINE_TEMPLATE U32 XXH32_digest_endian | ( | const XXH32_state_t * | state, |
XXH_endianess | endian | ||
) |
Definition at line 705 of file xxhash.c.
Referenced by XXH32_digest().
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.
Referenced by XXH32().
XXH_PUBLIC_API XXH_errorcode XXH32_freeState | ( | XXH32_state_t * | statePtr | ) |
XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical | ( | const XXH32_canonical_t * | src | ) |
XXH_PUBLIC_API XXH_errorcode XXH32_reset | ( | XXH32_state_t * | statePtr, |
unsigned int | seed | ||
) |
Definition at line 378 of file xxhash.c.
Referenced by XXH32_endian_align(), and XXH32_update_endian().
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.
Referenced by XXH32().
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.
Referenced by XXH32_update().
Definition at line 555 of file xxhash.c.
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().
XXH_PUBLIC_API void XXH64_canonicalFromHash | ( | XXH64_canonical_t * | dst, |
XXH64_hash_t | hash | ||
) |
XXH_PUBLIC_API void XXH64_copyState | ( | XXH64_state_t *restrict | dstState, |
const XXH64_state_t *restrict | srcState | ||
) |
XXH_PUBLIC_API XXH64_state_t * XXH64_createState | ( | void | ) |
XXH_PUBLIC_API unsigned long long XXH64_digest | ( | const XXH64_state_t * | state_in | ) |
Definition at line 874 of file xxhash.c.
Referenced by XXH64(), ZSTD_decompressContinue(), ZSTD_decompressFrame(), and ZSTD_writeEpilogue().
FORCE_INLINE_TEMPLATE U64 XXH64_digest_endian | ( | const XXH64_state_t * | state, |
XXH_endianess | endian | ||
) |
Definition at line 822 of file xxhash.c.
Referenced by XXH64_digest().
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.
Referenced by XXH64().
XXH_PUBLIC_API XXH_errorcode XXH64_freeState | ( | XXH64_state_t * | statePtr | ) |
XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical | ( | const XXH64_canonical_t * | src | ) |
Definition at line 478 of file xxhash.c.
Referenced by XXH64_digest_endian(), and XXH64_endian_align().
XXH_PUBLIC_API XXH_errorcode XXH64_reset | ( | XXH64_state_t * | statePtr, |
unsigned long long | seed | ||
) |
Definition at line 622 of file xxhash.c.
Referenced by XXH64(), ZSTD_decodeFrameHeader(), and ZSTD_resetCCtx_internal().
Definition at line 470 of file xxhash.c.
Referenced by XXH64_digest_endian(), XXH64_endian_align(), XXH64_mergeRound(), and XXH64_update_endian().
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.
Referenced by XXH64(), ZSTD_compress_frameChunk(), ZSTD_decompressContinue(), and ZSTD_decompressFrame().
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.
Referenced by XXH64_update().
Definition at line 119 of file xxhash.c.
Referenced by XXH32_freeState(), and XXH64_freeState().
Definition at line 115 of file xxhash.c.
Referenced by XXH32_createState(), and XXH64_createState().
Definition at line 147 of file xxhash.c.
Referenced by XXH32_update_endian(), and XXH64_update_endian().
Definition at line 223 of file xxhash.c.
Referenced by XXH_readBE32(), and XXH_readLE32_align().
Definition at line 230 of file xxhash.c.
Referenced by XXH_readBE64(), and XXH_readLE64_align().
FORCE_INLINE_TEMPLATE U32 XXH_readLE32 | ( | const void * | ptr, |
XXH_endianess | endian | ||
) |
Definition at line 307 of file xxhash.c.
Referenced by XXH32_digest_endian(), XXH32_update_endian(), and XXH64_digest_endian().
FORCE_INLINE_TEMPLATE U32 XXH_readLE32_align | ( | const void * | ptr, |
XXH_endianess | endian, | ||
XXH_alignment | align | ||
) |
FORCE_INLINE_TEMPLATE U64 XXH_readLE64 | ( | const void * | ptr, |
XXH_endianess | endian | ||
) |
Definition at line 325 of file xxhash.c.
Referenced by XXH64_digest_endian(), and XXH64_update_endian().
FORCE_INLINE_TEMPLATE U64 XXH_readLE64_align | ( | const void * | ptr, |
XXH_endianess | endian, | ||
XXH_alignment | align | ||
) |
Definition at line 261 of file xxhash.c.
Referenced by XXH32_canonicalFromHash(), XXH_readBE32(), and XXH_readLE32_align().
Definition at line 268 of file xxhash.c.
Referenced by XXH64_canonicalFromHash(), XXH_readBE64(), and XXH_readLE64_align().
XXH_PUBLIC_API unsigned XXH_versionNumber | ( | void | ) |
Definition at line 345 of file xxhash.c.
Referenced by XXH32_digest_endian(), XXH32_endian_align(), XXH32_reset(), and XXH32_round().
Definition at line 346 of file xxhash.c.
Referenced by XXH32_digest_endian(), XXH32_endian_align(), XXH32_reset(), and XXH32_round().
Definition at line 347 of file xxhash.c.
Referenced by XXH32_digest_endian(), and XXH32_endian_align().
Definition at line 348 of file xxhash.c.
Referenced by XXH32_digest_endian(), and XXH32_endian_align().
Definition at line 349 of file xxhash.c.
Referenced by XXH32_digest_endian(), and XXH32_endian_align().
Definition at line 351 of file xxhash.c.
Referenced by XXH64_digest_endian(), XXH64_endian_align(), XXH64_mergeRound(), XXH64_reset(), and XXH64_round().
Definition at line 352 of file xxhash.c.
Referenced by XXH64_digest_endian(), XXH64_endian_align(), XXH64_reset(), and XXH64_round().
Definition at line 353 of file xxhash.c.
Referenced by XXH64_digest_endian(), and XXH64_endian_align().
Definition at line 354 of file xxhash.c.
Referenced by XXH64_digest_endian(), XXH64_endian_align(), and XXH64_mergeRound().
Definition at line 355 of file xxhash.c.
Referenced by XXH64_digest_endian(), and XXH64_endian_align().