mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-14 16:12:24 -07:00
xxhash for ev & ui hashes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user