[gpos] Optimize PairPosFormat1::intersects

This commit is contained in:
Behdad Esfahbod 2022-12-03 13:14:31 -07:00
parent 58e9df132f
commit c482b06108
1 changed files with 14 additions and 1 deletions

View File

@ -51,8 +51,21 @@ struct PairPosFormat1_3
bool intersects (const hb_set_t *glyphs) const
{
auto &cov = this+coverage;
if (pairSet.len > glyphs->get_population () * hb_bit_storage ((unsigned) pairSet.len) / 4)
{
for (hb_codepoint_t g = HB_SET_VALUE_INVALID; glyphs->next (&g);)
{
unsigned i = cov.get_coverage (g);
if ((this+pairSet[i]).intersects (glyphs, valueFormat))
return true;
}
return false;
}
return
+ hb_zip (this+coverage, pairSet)
+ hb_zip (cov, pairSet)
| hb_filter (*glyphs, hb_first)
| hb_map (hb_second)
| hb_map ([glyphs, this] (const typename Types::template OffsetTo<PairSet> &_)