rtengine/src/runtime/hashing.c
Kevin Trogant 4e02d43514 Add early config file parsing
Also cleaned up contrib/ and made lz4 and xxhash subprojects installed
via wrap.
2024-07-19 10:30:50 +02:00

21 lines
661 B
C

#include "hashing.h"
#include <xxhash.h>
#include <assert.h>
/* XXH32/64 of "recreational.tech" with seed 0 */
#define HASH32_SEED 0xd9035e35
#define HASH64_SEED 0xa14e16c3ae8b282dULL
static_assert(sizeof(rt_hash64) == sizeof(XXH64_hash_t), "Size mismatch between rt_hash64 and XXH64_hash_t!");
static_assert(sizeof(rt_hash32) == sizeof(XXH32_hash_t),
"Size mismatch between rt_hash32 and XXH32_hash_t!");
RT_DLLEXPORT rt_hash64 rtHashBytes(const void *begin, size_t count) {
return XXH64(begin, count, HASH64_SEED);
}
RT_DLLEXPORT rt_hash32 rtHashBytes32(const void *begin, size_t count) {
return XXH32(begin, count, HASH32_SEED);
}