From c4d2d287fc0eac7348951ce275a1f3d80f25ef3d Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 17 Feb 2018 11:54:08 +0000 Subject: #complete switch; Removal of dyncall --- src/map.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/map.cpp') 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) { -- cgit v1.2.3