[set] Add pre-allocation internal API

pull/3594/head
Behdad Esfahbod 3 years ago
parent 48dfbd54a3
commit 1f578b5a32
  1. 1
      src/hb-bit-set-invertible.hh
  2. 7
      src/hb-bit-set.hh
  3. 1
      src/hb-set.hh

@ -56,6 +56,7 @@ struct hb_bit_set_invertible_t
bool in_error () const { return s.in_error (); }
explicit operator bool () const { return !is_empty (); }
void alloc (unsigned sz) { s.alloc (sz); }
void reset ()
{
s.reset ();

@ -97,6 +97,13 @@ struct hb_bit_set_t
return true;
}
void alloc (unsigned sz)
{
sz >>= (page_t::PAGE_BITS_LOG_2 - 1);
pages.alloc (sz);
page_map.alloc (sz);
}
void reset ()
{
successful = true;

@ -77,6 +77,7 @@ struct hb_sparseset_t
void err () { s.err (); }
bool in_error () const { return s.in_error (); }
void alloc (unsigned sz) { s.alloc (sz); }
void reset () { s.reset (); }
void clear () { s.clear (); }
void invert () { s.invert (); }

Loading…
Cancel
Save