[map] Don't resize map if not necessary
This commit is contained in:
parent
7595fa2d9a
commit
896377463f
|
@ -160,6 +160,8 @@ struct hb_hashmap_t
|
||||||
{
|
{
|
||||||
if (unlikely (!successful)) return false;
|
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 power = hb_bit_storage (hb_max (population, new_population) * 2 + 8);
|
||||||
unsigned int new_size = 1u << power;
|
unsigned int new_size = 1u << power;
|
||||||
item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t));
|
item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t));
|
||||||
|
|
Loading…
Reference in New Issue