Make Map_Info store pointers to cell info rather than inline

This commit is contained in:
gingerBill
2022-11-08 12:18:36 +00:00
parent 6dd4d1a924
commit ed58374964
11 changed files with 86 additions and 61 deletions
+3 -4
View File
@@ -272,13 +272,13 @@ clear_map :: proc "contextless" (m: ^$T/map[$K]$V) {
if m == nil {
return
}
map_clear_dynamic((^Raw_Map)(m), map_info(K, V))
map_clear_dynamic((^Raw_Map)(m), map_info(T))
}
@builtin
reserve_map :: proc(m: ^$T/map[$K]$V, capacity: int, loc := #caller_location) {
if m != nil {
__dynamic_map_reserve((^Raw_Map)(m), map_info(K, V), uint(capacity), loc)
__dynamic_map_reserve((^Raw_Map)(m), map_info(T), uint(capacity), loc)
}
}
@@ -306,8 +306,7 @@ shrink_map :: proc(m: ^$T/map[$K]$V, new_cap := -1, loc := #caller_location) ->
delete_key :: proc(m: ^$T/map[$K]$V, key: K) -> (deleted_key: K, deleted_value: V) {
if m != nil {
key := key
info := map_info(K, V)
_ = map_erase_dynamic((^Raw_Map)(m), info, uintptr(&key))
_ = map_erase_dynamic((^Raw_Map)(m), map_info(T), uintptr(&key))
// TODO(bill) old key and value
}
return