From 207ae11ab9f539272cd1969461a1023658b6e4b7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 5 Jan 2023 14:08:47 -0700 Subject: [PATCH] [set] Allocate first page exact --- src/hb-bit-set.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-bit-set.hh b/src/hb-bit-set.hh index 00eda5aec..475b07b81 100644 --- a/src/hb-bit-set.hh +++ b/src/hb-bit-set.hh @@ -88,6 +88,10 @@ struct hb_bit_set_t bool resize (unsigned int count, bool clear = true, bool exact_size = false) { if (unlikely (!successful)) return false; + + if (pages.length == 0 && count == 1) + exact_size = true; // Most sets are small and local + if (unlikely (!pages.resize (count, clear, exact_size) || !page_map.resize (count, clear, exact_size))) { pages.resize (page_map.length, clear, exact_size);