Browse Source

Fix `map_insert`

gingerBill 3 years ago
parent
commit
0380601bb4
1 changed files with 3 additions and 3 deletions
  1. 3 3
      core/runtime/core_builtin.odin

+ 3 - 3
core/runtime/core_builtin.odin

@@ -672,10 +672,10 @@ shrink_dynamic_array :: proc(array: ^$T/[dynamic]$E, new_cap := -1, loc := #call
 @builtin
 map_insert :: proc(m: ^$T/map[$K]$V, key: K, value: V, loc := #caller_location) -> (ptr: ^V) {
 	key, value := key, value
-	h := __get_map_header(m)
+	h := __get_map_header(T)
 
-	data := uintptr(__dynamic_map_set(h, __get_map_key_hash(&key), &key, &value, loc))
-	return (^V)(data + h.value_offset)
+	e := __dynamic_map_set(m, h, __get_map_key_hash(&key), &key, &value, loc)
+	return (^V)(uintptr(e) + h.value_offset)
 }