diff options
| author | gingerBill <bill@gingerbill.org> | 2018-02-17 11:54:08 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-02-17 11:54:08 +0000 |
| commit | c4d2d287fc0eac7348951ce275a1f3d80f25ef3d (patch) | |
| tree | e082b0f1d744689ced0cdab73dd405981cacbf3a /src/map.cpp | |
| parent | 6a85546b761b67fa012a2cd49e32b2211bf02971 (diff) | |
#complete switch; Removal of dyncall
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) { |