From e8ddf107d0f3ecd66db901c748028bf642210ae8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 22 Nov 2022 13:29:32 -0700 Subject: [PATCH] [gvar] Optimize a loop --- src/hb-ot-var-gvar-table.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index 2cde67d35..316be8b19 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -646,8 +646,9 @@ struct gvar /* Check the number of unreferenced points in a contour. If no unref points or no ref points, nothing to do. */ unsigned unref_count = 0; - for (unsigned i = start_point; i <= end_point; i++) - unref_count += !deltas.arrayZ[i].flag; + for (unsigned i = start_point; i < end_point + 1; i++) + unref_count += deltas.arrayZ[i].flag; + unref_count = (end_point - start_point + 1) - unref_count; unsigned j = start_point; if (unref_count == 0 || unref_count > end_point - start_point)