[cff] Micro-optimize memcpy

This commit is contained in:
Behdad Esfahbod 2022-11-22 12:19:28 -07:00
parent 2968dd7844
commit 13e1ca9eb5
1 changed files with 4 additions and 2 deletions

View File

@ -499,9 +499,11 @@ struct op_serializer_t
{
TRACE_SERIALIZE (this);
HBUINT8 *d = c->allocate_size<HBUINT8> (opstr.length);
unsigned char *d = c->allocate_size<unsigned char> (opstr.length);
if (unlikely (!d)) return_trace (false);
memcpy (d, opstr.ptr, opstr.length);
/* Faster than memcpy for small strings. */
for (unsigned i = 0; i < opstr.length; i++)
d[i] = opstr.ptr[i];
return_trace (true);
}
};