[map] Downgrade from quadratic to linear probing

This commit is contained in:
Behdad Esfahbod committed 2023-05-16 10:12:02 +02:00
1 parent 498197671a
commit 2dd0803c85
1 file changed
+1 -2
+1 -2
View File
@@ -400,7 +400,6 @@ struct hb_hashmap_t
{
hash &= 0x3FFFFFFF; // We only store lower 30bit of hash
unsigned int i = hash % prime;
unsigned int step = 0;
unsigned int tombstone = (unsigned) -1;
while (items[i].is_used ())
{
@@ -409,7 +408,7 @@ struct hb_hashmap_t
return items[i];
if (tombstone == (unsigned) -1 && items[i].is_tombstone ())
tombstone = i;
i = (i + ++step) & mask;
i = (i + 1) & mask;
}
return items[tombstone == (unsigned) -1 ? i : tombstone];
}