From 043980a60eb2fe93dd65b8c2f5eaa021fd8653f2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Feb 2025 10:58:03 -0700 Subject: [PATCH] [TupleValues] Micro-optimize --- src/hb-open-type.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 7dab842c2..3b2bd7660 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -1914,6 +1914,7 @@ struct TupleValues void _add_to (hb_array_t out, float scale = 1.0f) { unsigned n = out.length; + float *arrayZ = out.arrayZ; for (unsigned i = 0; i < n;) { @@ -1926,21 +1927,21 @@ struct TupleValues { const auto *pp = (const HBINT8 *) p; for (unsigned j = 0; j < count; j++) - out.arrayZ[i + j] += scaled ? *pp++ * scale : *pp++; + *arrayZ++ += scaled ? *pp++ * scale : *pp++; } break; case 2: { const auto *pp = (const HBINT16 *) p; for (unsigned j = 0; j < count; j++) - out.arrayZ[i + j] += scaled ? *pp++ * scale : *pp++; + *arrayZ++ += scaled ? *pp++ * scale : *pp++; } break; case 4: { const auto *pp = (const HBINT32 *) p; for (unsigned j = 0; j < count; j++) - out.arrayZ[i + j] += scaled ? *pp++ * scale : *pp++; + *arrayZ++ += scaled ? *pp++ * scale : *pp++; } break; }