From 3261e05bdbb067cb9411a38a585bb04be1fb2542 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 May 2022 13:16:31 -0600 Subject: [PATCH] [subset] Optimize ClassDef1::intersected_class_glyphs() for class0 --- src/hb-ot-layout-common.hh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index f2a58028e..655bd39a4 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -2057,10 +2057,13 @@ struct ClassDefFormat1 unsigned count = classValue.len; if (klass == 0) { - hb_codepoint_t endGlyph = startGlyph + count -1; - for (hb_codepoint_t g : glyphs->iter ()) - if (g < startGlyph || g > endGlyph) - intersect_glyphs->add (g); + for (unsigned g = HB_SET_VALUE_INVALID; + hb_set_next (glyphs, &g) && g < startGlyph;) + intersect_glyphs->add (g); + + for (unsigned g = startGlyph + count - 1; + hb_set_next (glyphs, &g);) + intersect_glyphs->add (g); return; }