[cff] Manually copy short strings instead of memcpy()

This commit is contained in:
Behdad Esfahbod 2022-11-21 17:04:55 -07:00
parent 38efd1862f
commit f263e3fe2e
1 changed files with 5 additions and 1 deletions

View File

@ -119,7 +119,11 @@ struct str_encoder_t
set_error ();
return;
}
memcpy (buff.arrayZ + offset, &str[0], str.length);
/* Since our strings are one or two bytes typically,
* this is faster than memcpy. */
for (unsigned i = 0; i < str.length; i++)
buff.arrayZ[i + offset] = str.arrayZ[i];
// memcpy (buff.arrayZ + offset, &str[0], str.length);
}
bool is_error () const { return error; }