109 return tommy_hash_u32(init_val, void_key, strlen(tommy_cast(
const char*, void_key)));
131 return tommy_hash_u64(init_val, void_key, strlen(tommy_cast(
const char*, void_key)));
163 key = ~key + (key << 21);
164 key = key ^ (key >> 24);
165 key = key + (key << 3) + (key << 8);
166 key = key ^ (key >> 14);
167 key = key + (key << 2) + (key << 4);
168 key = key ^ (key >> 28);
169 key = key + (key << 31);
207 key *= 0xbf58476d1ce4e5b9ULL;
209 key *= 0x94d049bb133111ebULL;
224#if defined(_MSC_VER) && defined(_M_X64)
228#pragma intrinsic(_umul128)
236#elif defined(_MSC_VER) && defined(_M_ARM64)
237#pragma intrinsic(__umulh)
245#elif defined(__x86_64__) && (defined(__GNUC__) || defined(__clang__))
258 :
"=a" (low),
"=d" (high)
266#elif defined(__SIZEOF_INT128__)
269 __uint128_t product = (__uint128_t)*A * *B;
273#elif defined(__aarch64__) && (defined(__GNUC__) || defined(__clang__))
void tommy_mum(tommy_uint64_t *A, tommy_uint64_t *B)
Multiplies two 64-bit unsigned numbers to obtain the full 128-bit product.
Definition: tommyhash.h:293
tommy_uint64_t tommy_strhash_u64(tommy_uint64_t init_val, const void *void_key)
String hash function with a 64-bit result.
Definition: tommyhash.h:129
tommy_uint32_t tommy_strhash_u32(tommy_uint32_t init_val, const void *void_key)
String hash function with a 32-bit result.
Definition: tommyhash.h:107
TOMMY_API tommy_uint64_t tommy_hash_u64(tommy_uint64_t init_val, const void *void_key, tommy_size_t key_len)
Hash function with a 64-bit result.
tommy_uint64_t tommy_inthash_u64(tommy_uint64_t key)
Reversible 64-bit integer hash function.
Definition: tommyhash.h:161
TOMMY_API tommy_uint32_t tommy_hash_u32(tommy_uint32_t init_val, const void *void_key, tommy_size_t key_len)
Hash function with a 32-bit result.
tommy_uint32_t tommy_mulhash_u32(tommy_uint32_t key)
Reversible 32-bit integer hash function using multiplications.
Definition: tommyhash.h:183
tommy_uint32_t tommy_inthash_u32(tommy_uint32_t key)
Reversible 32-bit integer hash function.
Definition: tommyhash.h:141
tommy_uint64_t tommy_mulhash_u64(tommy_uint64_t key)
Reversible 64-bit integer hash function using multiplications.
Definition: tommyhash.h:204
uint64_t tommy_uint64_t
Generic uint64_t type.
Definition: tommytypes.h:35
uint32_t tommy_uint32_t
Generic uint32_t type.
Definition: tommytypes.h:34
uint64_t tommy_size_t
Generic size_t type.
Definition: tommytypes.h:40