From 1856c52e585d9273bb812296288069359dee23e6 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 5 Aug 2025 09:27:31 -0700 Subject: [PATCH] xxhash for ctrl layer --- src/ctrl/ctrl_core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index 2415dc36..26b59be8 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -9,14 +9,16 @@ //////////////////////////////// //~ rjf: Basic Type Functions +#if !defined(XXH_IMPLEMENTATION) +# define XXH_IMPLEMENTATION +# define XXH_STATIC_LINKING_ONLY +# include "third_party/xxHash/xxhash.h" +#endif + internal U64 ctrl_hash_from_string(String8 string) { - U64 result = 5381; - 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, 5381); return result; }