From d2a2f5bf4ed66979b17332f35b52c3395b02ed2d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 25 Nov 2022 12:44:02 -0700 Subject: [PATCH] [vector] Handroll copy --- src/hb-vector.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 7304d9aeb..b914be184 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -267,7 +267,10 @@ struct hb_vector_t copy_vector (const hb_vector_t &other) { length = other.length; - hb_memcpy ((void *) arrayZ, (const void *) other.arrayZ, length * item_size); + /* This runs faster because of alignment. */ + for (unsigned i = 0; i < length; i++) + arrayZ[i] = other.arrayZ[i]; + //hb_memcpy ((void *) arrayZ, (const void *) other.arrayZ, length * item_size); } template