diff options
Diffstat (limited to 'src/map.cpp')
| -rw-r--r-- | src/map.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp index 08a059d56..a08070656 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -30,8 +30,8 @@ struct HashKey { // u128 key; u64 key; union { - String string; // if String, s.len > 0 - void * ptr; + String string; // if String, s.len > 0 + void * ptr; PtrAndId ptr_and_id; }; }; @@ -65,6 +65,16 @@ gb_inline HashKey hash_ptr_and_id(void *ptr, u32 id) { h.ptr_and_id.id = id; return h; } +gb_inline HashKey hash_integer(u64 u) { + HashKey h = {HashKey_Default}; + h.key = u; + return h; +} +gb_inline HashKey hash_f64(f64 f) { + HashKey h = {HashKey_Default}; + h.key = *cast(u64 *)&f; + return h; +} bool hash_key_equal(HashKey a, HashKey b) { if (a.key == b.key) { |