mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-04 12:58:41 +00: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
|
//~ 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
|
internal EV_Key
|
||||||
ev_key_make(U64 parent_hash, U64 child_id)
|
ev_key_make(U64 parent_hash, U64 child_id)
|
||||||
{
|
{
|
||||||
@@ -74,11 +80,7 @@ ev_key_match(EV_Key a, EV_Key b)
|
|||||||
internal U64
|
internal U64
|
||||||
ev_hash_from_seed_string(U64 seed, String8 string)
|
ev_hash_from_seed_string(U64 seed, String8 string)
|
||||||
{
|
{
|
||||||
U64 result = seed;
|
U64 result = XXH3_64bits_withSeed(string.str, string.size, seed);
|
||||||
for(U64 i = 0; i < string.size; i += 1)
|
|
||||||
{
|
|
||||||
result = ((result << 5) + result) + string.str[i];
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -12,14 +12,16 @@ thread_static UI_State *ui_state = 0;
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Basic Type Functions
|
//~ 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
|
internal U64
|
||||||
ui_hash_from_string(U64 seed, String8 string)
|
ui_hash_from_string(U64 seed, String8 string)
|
||||||
{
|
{
|
||||||
U64 result = seed;
|
U64 result = XXH3_64bits_withSeed(string.str, string.size, seed);
|
||||||
for(U64 i = 0; i < string.size; i += 1)
|
|
||||||
{
|
|
||||||
result = ((result << 5) + result) + string.str[i];
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user