#pragma once #define HASH_CSTR(str) murmur_hash64(str, strlen(str), 0) #define HASH_STR(str, len) murmur_hash64(str, len, 0) const uint64_t HASH_UNUSED = 0xFFFFFFFFFFFFFFFFU; enum { NEAREST_PRIME_8 = 11, NEAREST_PRIME_16 = 17, NEAREST_PRIME_32 = 37, NEAREST_PRIME_64 = 67, NEAREST_PRIME_128 = 131, NEAREST_PRIME_256 = 257, NEAREST_PRIME_512 = 521, NEAREST_PRIME_1024 = 1031 }; typedef struct hash { int count; int capacity; int element_size; uint64_t* keys; void* data; } hash_t; hash_t hash_create(size_t capacity, size_t element_size); void hash_reset(hash_t* hash); void hash_add(hash_t* hash, uint64_t key, void* element); void* hash_get(hash_t hash, uint64_t key);