hmap_chained: fix for not properly being able to override slots with matching key (that were still occupied)

This commit is contained in:
Edward R. Gonzalez 2024-12-31 02:38:22 -05:00
parent b54d336193
commit 1fb011f56c

View File

@ -223,7 +223,7 @@ hmap_chained_set :: proc( self : HMapChained($Type), key : u64, value : Type ) -
return & surface_slot.value, error
}
if ! surface_slot.occupied
if ! surface_slot.occupied || surface_slot.key == key
{
surface_slot.key = key
surface_slot.value = value
@ -257,7 +257,7 @@ hmap_chained_set :: proc( self : HMapChained($Type), key : u64, value : Type ) -
}
}
if ! slot.next.occupied
if ! slot.next.occupied || surface_slot.key == key
{
slot.next.key = key
slot.next.value = value