From e8de5cb08f209ce3901c53e86eade2238e0fb894 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 20 Jul 2023 11:31:13 -0600 Subject: [PATCH] [gsubgpos] Use a couple variables --- src/hb-ot-layout-gsubgpos.hh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 00fe03a8d..bc793ebf3 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -2214,6 +2214,8 @@ struct RuleSet unsafe_to2 = skippy_iter.idx + 1; } + auto match_input = lookup_context.funcs.match; + auto *input_data = lookup_context.match_data; for (unsigned int i = 0; i < num_rules; i++) { const auto &r = this+rule.arrayZ[i]; @@ -2221,13 +2223,13 @@ struct RuleSet const auto &input = r.inputZ; if (r.inputCount <= 1 || - (!lookup_context.funcs.match || - lookup_context.funcs.match (*first, input.arrayZ[0], lookup_context.match_data))) + (!match_input || + match_input (*first, input.arrayZ[0], input_data))) { if (!second || (r.inputCount <= 2 || - (!lookup_context.funcs.match || - lookup_context.funcs.match (*second, input.arrayZ[1], lookup_context.match_data))) + (!match_input || + match_input (*second, input.arrayZ[1], input_data))) ) { if (r.apply (c, lookup_context)) @@ -3384,6 +3386,10 @@ struct ChainRuleSet unsafe_to2 = skippy_iter.idx + 1; } + auto match_input = lookup_context.funcs.match[1]; + auto match_lookahead = lookup_context.funcs.match[2]; + auto *input_data = lookup_context.match_data[1]; + auto *lookahead_data = lookup_context.match_data[2]; for (unsigned int i = 0; i < num_rules; i++) { const auto &r = this+rule.arrayZ[i]; @@ -3393,19 +3399,19 @@ struct ChainRuleSet unsigned lenP1 = hb_max ((unsigned) input.lenP1, 1u); if (lenP1 > 1 ? - (!lookup_context.funcs.match[1] || - lookup_context.funcs.match[1] (*first, input.arrayZ[0], lookup_context.match_data[1])) + (!match_input || + match_input (*first, input.arrayZ[0], input_data)) : - (!lookahead.len || !lookup_context.funcs.match[2] || - lookup_context.funcs.match[2] (*first, lookahead.arrayZ[0], lookup_context.match_data[2]))) + (!lookahead.len || !match_lookahead || + match_lookahead (*first, lookahead.arrayZ[0], lookahead_data))) { if (!second || (lenP1 > 2 ? - (!lookup_context.funcs.match[1] || - lookup_context.funcs.match[1] (*second, input.arrayZ[1], lookup_context.match_data[1])) + (!match_input || + match_input (*second, input.arrayZ[1], input_data)) : - (lookahead.len <= 2 - lenP1 || !lookup_context.funcs.match[2] || - lookup_context.funcs.match[2] (*second, lookahead.arrayZ[2 - lenP1], lookup_context.match_data[2])))) + (lookahead.len <= 2 - lenP1 || !match_lookahead || + match_lookahead (*second, lookahead.arrayZ[2 - lenP1], lookahead_data)))) { if (r.apply (c, lookup_context)) {