move count decrement into mark_slot_for_reuse because that makes more sense
This commit is contained in:
parent
28131b6b01
commit
a1df989324
1 changed files with 2 additions and 1 deletions
|
|
@ -52,7 +52,6 @@ evict :: (kv: *Kv, key: kv.Key) -> kv.Value, bool {
|
||||||
|
|
||||||
last_value := slot.value;
|
last_value := slot.value;
|
||||||
mark_slot_for_reuse(kv, idx);
|
mark_slot_for_reuse(kv, idx);
|
||||||
kv.count -= 1;
|
|
||||||
|
|
||||||
return last_value, true;
|
return last_value, true;
|
||||||
}
|
}
|
||||||
|
|
@ -107,7 +106,9 @@ create_or_reuse_slot :: (kv: *Kv) -> *kv.Slot {
|
||||||
mark_slot_for_reuse :: (kv: *Kv, index: int) {
|
mark_slot_for_reuse :: (kv: *Kv, index: int) {
|
||||||
inline try_lazy_init(kv);
|
inline try_lazy_init(kv);
|
||||||
|
|
||||||
|
kv.count -= 1;
|
||||||
kv.slots[index] = .{ hash = kv.invalid_hash };
|
kv.slots[index] = .{ hash = kv.invalid_hash };
|
||||||
|
|
||||||
array.append(*kv.free_slots, index);
|
array.append(*kv.free_slots, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue