[subset-cff] Micro-optimize copy_str more

This commit is contained in:
Behdad Esfahbod 2022-11-25 14:43:44 -07:00
parent d2f3cde7ef
commit 74acf52f33
1 changed files with 4 additions and 1 deletions

View File

@ -120,8 +120,11 @@ struct str_encoder_t
/* Faster than hb_memcpy for small strings. */ /* Faster than hb_memcpy for small strings. */
auto arr = buff.arrayZ + offset; auto arr = buff.arrayZ + offset;
for (unsigned i = 0; i < length; i++) /* Length is at least one; and mostly just one. */
arr[0] = str[0];
for (unsigned i = 1; i < length; i++)
arr[i] = str[i]; arr[i] = str[i];
//hb_memcpy (buff.arrayZ + offset, str, length); //hb_memcpy (buff.arrayZ + offset, str, length);
} }