diff --git a/src/hb-bit-set-invertible.hh b/src/hb-bit-set-invertible.hh index 1b12e008e..e89712a8f 100644 --- a/src/hb-bit-set-invertible.hh +++ b/src/hb-bit-set-invertible.hh @@ -123,11 +123,10 @@ struct hb_bit_set_invertible_t bool is_subset (const hb_bit_set_invertible_t &larger_set) const { - if (unlikely (inverted && !larger_set.inverted)) return false; /*XXX*/ - if (unlikely (!inverted && larger_set.inverted)) + if (unlikely (inverted != larger_set.inverted)) return hb_all (hb_iter (s) | hb_map (larger_set.s)); - /* inverted == larger_set.inverted */ - return unlikely (inverted) ? larger_set.s.is_subset (s) : s.is_subset (larger_set.s); + else + return unlikely (inverted) ? larger_set.s.is_subset (s) : s.is_subset (larger_set.s); } protected: diff --git a/src/hb-bit-set.hh b/src/hb-bit-set.hh index a4a2aed2a..511c24fcb 100644 --- a/src/hb-bit-set.hh +++ b/src/hb-bit-set.hh @@ -342,7 +342,8 @@ struct hb_bit_set_t bool is_equal (const hb_bit_set_t &other) const { - if (get_population () != other.get_population ()) + if (has_population () && other.has_population () && + get_population () != other.get_population ()) return false; unsigned int na = pages.length; @@ -369,9 +370,11 @@ struct hb_bit_set_t bool is_subset (const hb_bit_set_t &larger_set) const { - /* TODO: Merge this and is_equal() into something like process(). */ - if (unlikely(larger_set.is_empty ())) - return is_empty (); +// /* TODO: Merge this and is_equal() into something like process(). */ + + if (has_population () && larger_set.has_population () && + get_population () != larger_set.get_population ()) + return false; uint32_t spi = 0; for (uint32_t lpi = 0; spi < page_map.length && lpi < larger_set.page_map.length; lpi++) @@ -698,9 +701,10 @@ struct hb_bit_set_t return true; } + bool has_population () const { return population != UINT_MAX; } unsigned int get_population () const { - if (population != UINT_MAX) + if (has_population ()) return population; unsigned int pop = 0;