xxhash for ev & ui hashes

This commit is contained in:
Ryan Fleury
2024-11-08 14:57:58 -08:00
parent 5232ba298d
commit 04c1488cd4
2 changed files with 14 additions and 10 deletions
+7 -5
View File
@@ -12,14 +12,16 @@ thread_static UI_State *ui_state = 0;
////////////////////////////////
//~ rjf: Basic Type Functions
#if !defined(XXH_IMPLEMENTATION)
# define XXH_IMPLEMENTATION
# define XXH_STATIC_LINKING_ONLY
# include "linker/third_party_ext/xxHash/xxhash.h"
#endif
internal U64
ui_hash_from_string(U64 seed, String8 string)
{
U64 result = seed;
for(U64 i = 0; i < string.size; i += 1)
{
result = ((result << 5) + result) + string.str[i];
}
U64 result = XXH3_64bits_withSeed(string.str, string.size, seed);
return result;
}