diff --git a/src/eval_visualization/eval_visualization_core.c b/src/eval_visualization/eval_visualization_core.c index b8974c71..272d6e1b 100644 --- a/src/eval_visualization/eval_visualization_core.c +++ b/src/eval_visualization/eval_visualization_core.c @@ -39,6 +39,12 @@ EV_VIEW_RULE_EXPR_EXPAND_NUM_FROM_ID_FUNCTION_DEF(identity) //////////////////////////////// //~ rjf: Key Functions +#if !defined(XXH_IMPLEMENTATION) +# define XXH_IMPLEMENTATION +# define XXH_STATIC_LINKING_ONLY +# include "linker/third_party_ext/xxHash/xxhash.h" +#endif + internal EV_Key ev_key_make(U64 parent_hash, U64 child_id) { @@ -74,11 +80,7 @@ ev_key_match(EV_Key a, EV_Key b) internal U64 ev_hash_from_seed_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; } diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index 904b22a5..865d6271 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -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; }