move count decrement into mark_slot_for_reuse because that makes more sense

This commit is contained in:
Judah Caruso 2025-05-27 00:08:38 -06:00
parent 28131b6b01
commit a1df989324

View file

@ -52,7 +52,6 @@ evict :: (kv: *Kv, key: kv.Key) -> kv.Value, bool {
last_value := slot.value;
mark_slot_for_reuse(kv, idx);
kv.count -= 1;
return last_value, true;
}
@ -107,7 +106,9 @@ create_or_reuse_slot :: (kv: *Kv) -> *kv.Slot {
mark_slot_for_reuse :: (kv: *Kv, index: int) {
inline try_lazy_init(kv);
kv.count -= 1;
kv.slots[index] = .{ hash = kv.invalid_hash };
array.append(*kv.free_slots, index);
}