From e630a65e604ea4d1fc4fb4818c456c3d450fede4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 22 Nov 2022 11:27:05 -0700 Subject: [PATCH] [gvar] Micro-optize vector extend --- src/hb-ot-var-gvar-table.hh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index 949a83288..cdfe5b984 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -60,8 +60,7 @@ struct contour_point_vector_t : hb_vector_t return; auto arrayZ = this->arrayZ + old_len; unsigned count = a.length; - for (unsigned int i = 0; i < count; i++) - arrayZ[i] = a.arrayZ[i]; + hb_memcpy (arrayZ, a.arrayZ, count * sizeof (arrayZ[0])); } void transform (const float (&matrix)[4]) @@ -566,9 +565,8 @@ struct gvar /* Save original points for inferred delta calculation */ contour_point_vector_t orig_points; - if (unlikely (!orig_points.resize (points.length, false))) return false; - for (unsigned int i = 0; i < orig_points.length; i++) - orig_points.arrayZ[i] = points.arrayZ[i]; + orig_points.extend (points); + if (unlikely (orig_points.in_error ())) return false; contour_point_vector_t deltas; /* flag is used to indicate referenced point */ if (unlikely (!deltas.resize (points.length, false))) return false;