Add set symmetric difference

This commit is contained in:
Behdad Esfahbod 2012-05-25 13:48:00 -04:00
parent 27aba594c9
commit 62c3e111fc
3 changed files with 18 additions and 0 deletions

View File

@ -102,6 +102,11 @@ struct _hb_set_t
for (unsigned int i = 0; i < ELTS; i++)
elts[i] &= ~other->elts[i];
}
inline void symmetric_difference (const hb_set_t *other)
{
for (unsigned int i = 0; i < ELTS; i++)
elts[i] ^= other->elts[i];
}
inline hb_codepoint_t get_min (void) const
{
for (unsigned int i = 0; i < ELTS; i++)

View File

@ -164,6 +164,13 @@ hb_set_subtract (hb_set_t *set,
set->subtract (other);
}
void
hb_set_symmetric_difference (hb_set_t *set,
hb_set_t *other)
{
set->symmetric_difference (other);
}
hb_codepoint_t
hb_set_min (hb_set_t *set)
{

View File

@ -105,9 +105,15 @@ void
hb_set_subtract (hb_set_t *set,
hb_set_t *other);
void
hb_set_symmetric_difference (hb_set_t *set,
hb_set_t *other);
/* Undefined if set empty */
hb_codepoint_t
hb_set_min (hb_set_t *set);
/* Undefined if set empty */
hb_codepoint_t
hb_set_max (hb_set_t *set);