From 59cfb4c570b0e11470900264b151295e64226947 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 1 Nov 2023 16:25:50 -0600 Subject: [PATCH] [instancing] Micro-optimize a loop --- src/hb-ot-var-common.hh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index b62458c9f..ee5877ea1 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -516,14 +516,19 @@ struct tuple_delta_t return *this; unsigned num = indices.length; - for (unsigned i = 0; i < num; i++) - { - if (!indices.arrayZ[i]) continue; - - deltas_x[i] *= scalar; - if (deltas_y) - deltas_y[i] *= scalar; - } + if (deltas_y) + for (unsigned i = 0; i < num; i++) + { + if (!indices.arrayZ[i]) continue; + deltas_x[i] *= scalar; + deltas_y[i] *= scalar; + } + else + for (unsigned i = 0; i < num; i++) + { + if (!indices.arrayZ[i]) continue; + deltas_x[i] *= scalar; + } return *this; }