mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-30 09:54:45 +00:00
#complete switch; Removal of dyncall
This commit is contained in:
14
src/map.cpp
14
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) {
|
||||
|
||||
Reference in New Issue
Block a user