[map] Don't resize map if not necessary

pull/3885/head
Behdad Esfahbod 2 years ago
parent 7595fa2d9a
commit 896377463f
  1. 2
      src/hb-map.hh

@ -160,6 +160,8 @@ struct hb_hashmap_t
{
if (unlikely (!successful)) return false;
if (new_population != 0 && new_population <= population) return true;
unsigned int power = hb_bit_storage (hb_max (population, new_population) * 2 + 8);
unsigned int new_size = 1u << power;
item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t));

Loading…
Cancel
Save