From 2dfc104236395f224b6834ab52263fbafbe92651 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 19 Aug 2021 14:47:33 -0600 Subject: [PATCH] [bit-set-invertible] Implement is_empty() for inverted case as well --- src/hb-bit-set-invertible.hh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hb-bit-set-invertible.hh b/src/hb-bit-set-invertible.hh index 030fc9867..fe3d9fa85 100644 --- a/src/hb-bit-set-invertible.hh +++ b/src/hb-bit-set-invertible.hh @@ -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)