From 19ab59f2f66b77ed90521cd662ee781db43ca079 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 21 Dec 2025 20:32:21 -0700 Subject: [PATCH] [scalar-cache] Unroll a loop --- src/hb-ot-layout-common.hh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index dff402068..5c0533aad 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -2586,7 +2586,17 @@ struct hb_scalar_cache_t void clear () { auto *values = &static_values[0]; - for (unsigned i = 0; i < length; i++) + unsigned i = 0; +#ifndef HB_OPTIMIZE_SIZE + for (; i + 3 < length; i += 4) + { + values[i + 0] = INVALID; + values[i + 1] = INVALID; + values[i + 2] = INVALID; + values[i + 3] = INVALID; + } +#endif + for (; i < length; i++) values[i] = INVALID; }