[bit-set-invertible] Second try fixing previous()
This commit is contained in:
parent
8f88747a5e
commit
84c2a30214
|
@ -211,6 +211,12 @@ struct hb_bit_set_invertible_t
|
|||
return s.next (codepoint);
|
||||
|
||||
auto old = *codepoint;
|
||||
if (unlikely (old + 1 == INVALID))
|
||||
{
|
||||
*codepoint = INVALID;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto v = old;
|
||||
s.next (&v);
|
||||
if (old + 1 < v)
|
||||
|
@ -219,12 +225,6 @@ struct hb_bit_set_invertible_t
|
|||
return true;
|
||||
}
|
||||
|
||||
if (unlikely (old + 1 == INVALID))
|
||||
{
|
||||
*codepoint = INVALID;
|
||||
return false;
|
||||
}
|
||||
|
||||
v = old;
|
||||
s.next_range (&old, &v);
|
||||
|
||||
|
@ -237,20 +237,21 @@ struct hb_bit_set_invertible_t
|
|||
return s.previous (codepoint);
|
||||
|
||||
auto old = *codepoint;
|
||||
auto v = old;
|
||||
s.previous (&v);
|
||||
if (old - 1 > v || v == INVALID)
|
||||
{
|
||||
*codepoint = old - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (unlikely (old - 1 == INVALID))
|
||||
{
|
||||
*codepoint = INVALID;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto v = old;
|
||||
s.previous (&v);
|
||||
|
||||
if (old - 1 > v || v == INVALID)
|
||||
{
|
||||
*codepoint = old - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
v = old;
|
||||
s.previous_range (&v, &old);
|
||||
|
||||
|
|
Loading…
Reference in New Issue