mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Minor code changes to Map/StringMap
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ GB_STATIC_ASSERT(gb_size_of(u64) >= gb_size_of(void *));
|
|||||||
|
|
||||||
gb_inline HashKey hashing_proc(void const *data, isize len) {
|
gb_inline HashKey hashing_proc(void const *data, isize len) {
|
||||||
HashKey h = {};
|
HashKey h = {};
|
||||||
h.key = gb_fnv64a(data, len);
|
h.key = fnv64a(data, len);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-7
@@ -10,16 +10,15 @@ struct StringHashKey {
|
|||||||
String string;
|
String string;
|
||||||
};
|
};
|
||||||
|
|
||||||
StringHashKey string_hashing_proc(void const *data, isize len) {
|
u64 string_hashing_proc(void const *data, isize len) {
|
||||||
StringHashKey h = {};
|
return fnv64a(data, len);
|
||||||
h.hash = gb_fnv64a(data, len);
|
|
||||||
h.string.text = (u8 *)data;
|
|
||||||
h.string.len = len;
|
|
||||||
return h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gb_inline StringHashKey string_hash_string(String const &s) {
|
gb_inline StringHashKey string_hash_string(String const &s) {
|
||||||
return string_hashing_proc(s.text, s.len);
|
StringHashKey hash_key = {};
|
||||||
|
hash_key.hash = string_hashing_proc(s.text, s.len);
|
||||||
|
hash_key.string = s;
|
||||||
|
return hash_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user