From 025a68cb074cde6b150f7edaf9fa87cb11773b56 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 18 Nov 2022 16:33:04 -0700 Subject: [PATCH] [map] Optimize copy resizing logic --- src/hb-map.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-map.hh b/src/hb-map.hh index 8d3d98b25..f8e3fab05 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -159,7 +159,7 @@ struct hb_hashmap_t { if (unlikely (!successful)) return false; - if (new_population != 0 && new_population <= population) return true; + if (new_population != 0 && (new_population + new_population / 2) < mask) return true; unsigned int power = hb_bit_storage (hb_max ((unsigned) population, new_population) * 2 + 8); unsigned int new_size = 1u << power;