[set] Add inverted to page_t::get_min/max()

This commit is contained in:
Behdad Esfahbod committed 2021-08-15 18:59:58 -06:00
1 parent 0dcd9b15d9
commit 4394ee1f1d
1 file changed
+12 -6
+12 -6
View File
@@ -186,18 +186,24 @@ struct hb_set_t
*codepoint = INVALID;
return false;
}
hb_codepoint_t get_min () const
hb_codepoint_t get_min (bool inverted = false) const
{
for (unsigned int i = 0; i < len (); i++)
if (v[i])
return i * ELT_BITS + elt_get_min (v[i]);
{
elt_t e = inverted ? ~v[i] : v[i];
if (e)
return i * ELT_BITS + elt_get_min (e);
}
return INVALID;
}
hb_codepoint_t get_max () const
hb_codepoint_t get_max (bool inverted = false) const
{
for (int i = len () - 1; i >= 0; i--)
if (v[i])
return i * ELT_BITS + elt_get_max (v[i]);
{
elt_t e = inverted ? ~v[i] : v[i];
if (e)
return i * ELT_BITS + elt_get_max (e);
}
return 0;
}