bool intersects (hb_codepoint_t first, hb_codepoint_t last) const
{
hb_codepoint_t c = first - 1; return next (&c) && c <= last;
}
void set (const hb_bit_set_invertible_t &other)
{
s.set (other.s); if (likely (s.successful))
inverted = other.inverted;
}
bool is_equal (const hb_bit_set_invertible_t &other) const
{ if (likely (inverted == other.inverted)) return s.is_equal (other.s); else
{ /* TODO Add iter_ranges() and use here. */ auto it1 = iter (); auto it2 = other.iter (); return hb_all (+ hb_zip (it1, it2)
| hb_map ([](hb_codepoint_pair_t _) { return _.first == _.second; }));
}
}
bool is_subset (const hb_bit_set_invertible_t &larger_set) const
{ if (unlikely (inverted != larger_set.inverted))
{ if (inverted) return hb_all (iter (), larger_set.s); else // larger set is inverted so larger_set.s is the set of things that are not present // in larger_set, therefore if s has any of those it can't be a subset. return !s.intersects (larger_set.s);
} else return unlikely (inverted) ? larger_set.s.is_subset (s) : s.is_subset (larger_set.s);
}
protected: template <typename Op> void process (const Op& op, const hb_bit_set_invertible_t &other)
{ s.process (op, other.s); } public: void union_ (const hb_bit_set_invertible_t &other)
{ if (likely (inverted == other.inverted))
{ if (unlikely (inverted))
process (hb_bitwise_and, other); else
process (hb_bitwise_or, other); /* Main branch. */
} else
{ if (unlikely (inverted))
process (hb_bitwise_gt, other); else
process (hb_bitwise_lt, other);
} if (likely (s.successful))
inverted = inverted || other.inverted;
} void intersect (const hb_bit_set_invertible_t &other)
{ if (likely (inverted == other.inverted))
{ if (unlikely (inverted))
process (hb_bitwise_or, other); else
process (hb_bitwise_and, other); /* Main branch. */
} else
{ if (unlikely (inverted))
process (hb_bitwise_lt, other); else
process (hb_bitwise_gt, other);
} if (likely (s.successful))
inverted = inverted && other.inverted;
} void subtract (const hb_bit_set_invertible_t &other)
{ if (likely (inverted == other.inverted))
{ if (unlikely (inverted))
process (hb_bitwise_lt, other); else
process (hb_bitwise_gt, other); /* Main branch. */
} else
{ if (unlikely (inverted))
process (hb_bitwise_or, other); else
process (hb_bitwise_and, other);
} if (likely (s.successful))
inverted = inverted && !other.inverted;
} void symmetric_difference (const hb_bit_set_invertible_t &other)
{
process (hb_bitwise_xor, other); if (likely (s.successful))
inverted = inverted ^ other.inverted;
}
bool next (hb_codepoint_t *codepoint) const
{ if (likely (!inverted)) return s.next (codepoint);
auto old = *codepoint; if (unlikely (old + 1 == INVALID))
{
*codepoint = INVALID; returnfalse;
}
auto v = old;
s.next (&v); if (old + 1 < v)
{
*codepoint = old + 1; returntrue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.