[bit-set-invertible] Plug in next_range()/previous_range()
This commit is contained in:
parent
f6aa37159b
commit
c27f5b1288
|
@ -187,13 +187,39 @@ struct hb_bit_set_invertible_t
|
||||||
}
|
}
|
||||||
bool next_range (hb_codepoint_t *first, hb_codepoint_t *last) const
|
bool next_range (hb_codepoint_t *first, hb_codepoint_t *last) const
|
||||||
{
|
{
|
||||||
/*XXX(inverted)*/
|
hb_codepoint_t i;
|
||||||
return s.next_range (first, last);
|
|
||||||
|
i = *last;
|
||||||
|
if (!next (&i))
|
||||||
|
{
|
||||||
|
*last = *first = INVALID;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO Speed up. */
|
||||||
|
*last = *first = i;
|
||||||
|
while (next (&i) && i == *last + 1)
|
||||||
|
(*last)++;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
bool previous_range (hb_codepoint_t *first, hb_codepoint_t *last) const
|
bool previous_range (hb_codepoint_t *first, hb_codepoint_t *last) const
|
||||||
{
|
{
|
||||||
/*XXX(inverted)*/
|
hb_codepoint_t i;
|
||||||
return s.previous_range (first, last);
|
|
||||||
|
i = *first;
|
||||||
|
if (!previous (&i))
|
||||||
|
{
|
||||||
|
*last = *first = INVALID;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO Speed up. */
|
||||||
|
*last = *first = i;
|
||||||
|
while (previous (&i) && i == *first - 1)
|
||||||
|
(*first)--;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_population () const
|
unsigned int get_population () const
|
||||||
|
|
Loading…
Reference in New Issue