[vector] Handroll copy

This commit is contained in:
Behdad Esfahbod 2022-11-25 12:44:02 -07:00
parent 1fed366d5b
commit d2a2f5bf4e
1 changed files with 4 additions and 1 deletions

View File

@ -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 <typename T = Type,
hb_enable_if (!hb_is_trivially_copyable (T) &&