[bit-set-invertible] Implement is_empty() for inverted case as well

This commit is contained in:
Behdad Esfahbod 2021-08-19 14:47:33 -06:00
parent ec4812a7d4
commit 2dfc104236
1 changed files with 6 additions and 1 deletions

View File

@ -50,7 +50,12 @@ struct hb_bit_set_invertible_t
void clear () { s.clear (); inverted = false; }
void invert () { if (!s.in_error ()) inverted = !inverted; }
bool is_empty () const { return inverted ? /*XXX*/false : s.is_empty (); }
bool is_empty () const
{
hb_codepoint_t v = INVALID;
next (&v);
return v == INVALID;
}
void add (hb_codepoint_t g) { unlikely (inverted) ? s.del (g) : s.add (g); }
bool add_range (hb_codepoint_t a, hb_codepoint_t b)