[set] Allocate first page exact
This commit is contained in:
parent
0b7f6d6cf0
commit
207ae11ab9
|
@ -88,6 +88,10 @@ struct hb_bit_set_t
|
||||||
bool resize (unsigned int count, bool clear = true, bool exact_size = false)
|
bool resize (unsigned int count, bool clear = true, bool exact_size = false)
|
||||||
{
|
{
|
||||||
if (unlikely (!successful)) return 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)))
|
if (unlikely (!pages.resize (count, clear, exact_size) || !page_map.resize (count, clear, exact_size)))
|
||||||
{
|
{
|
||||||
pages.resize (page_map.length, clear, exact_size);
|
pages.resize (page_map.length, clear, exact_size);
|
||||||
|
|
Loading…
Reference in New Issue