From c7493efeafcf2ac9af39e8049a2a907065e26756 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 3 Jun 2023 15:39:27 -0600 Subject: [PATCH] [subset/loca] Micro-optimize --- src/OT/glyf/glyf-helpers.hh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/OT/glyf/glyf-helpers.hh b/src/OT/glyf/glyf-helpers.hh index 9062c9c65..8fa4e6a98 100644 --- a/src/OT/glyf/glyf-helpers.hh +++ b/src/OT/glyf/glyf-helpers.hh @@ -24,13 +24,15 @@ _write_loca (IteratorIn&& it, unsigned num_glyphs = num_offsets - 1; unsigned right_shift = short_offsets ? 1 : 0; unsigned offset = 0; - *dest++ = 0; + TypeOut value; + value = 0; + *dest++ = value; for (hb_codepoint_t i = 0, j = 0; i < num_glyphs; i++) { if (i != new_to_old_gid_list[j].first) { DEBUG_MSG (SUBSET, nullptr, "loca entry empty offset %u", offset); - *dest++ = offset >> right_shift; + *dest++ = value; continue; } @@ -38,7 +40,8 @@ _write_loca (IteratorIn&& it, unsigned padded_size = *it++; offset += padded_size; DEBUG_MSG (SUBSET, nullptr, "loca entry offset %u padded-size %u", offset, padded_size); - *dest++ = offset >> right_shift; + value = offset >> right_shift; + *dest++ = value; } }