From 0270e3e97492d975c7f65bb01dd819a4c9314cae Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 May 2023 23:46:18 -0600 Subject: [PATCH] [map] Reinstate quadratic probing --- src/hb-map.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-map.hh b/src/hb-map.hh index 91ccb196f..21c7ba1b4 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -208,6 +208,7 @@ struct hb_hashmap_t hash &= 0x3FFFFFFF; // We only store lower 30bit of hash unsigned int i = hash % prime; + unsigned step = 0; while (items[i].is_used ()) { if ((hb_is_same (K, hb_codepoint_t) || items[i].hash == hash) && @@ -215,7 +216,7 @@ struct hb_hashmap_t break; if (items[i].is_tombstone ()) break; - i = (i + 1) & mask; + i = (i + ++step) & mask; } item_t &item = items[i]; @@ -285,6 +286,7 @@ struct hb_hashmap_t hash &= 0x3FFFFFFF; // We only store lower 30bit of hash unsigned int i = hash % prime; + unsigned step = 0; while (items[i].is_used ()) { if ((hb_is_same (K, hb_codepoint_t) || items[i].hash == hash) && @@ -295,7 +297,7 @@ struct hb_hashmap_t else return nullptr; } - i = (i + 1) & mask; + i = (i + ++step) & mask; } return nullptr; }