[cff] Optimize byte_str_ref_t inc()

Shows a couple percent speedup.
This commit is contained in:
Behdad Esfahbod 2022-11-21 14:03:28 -07:00
parent 3ff75411bd
commit a81ec9b2b6
1 changed files with 2 additions and 4 deletions

View File

@ -315,10 +315,8 @@ struct byte_str_ref_t
{ return get_offset () + count <= str.length; }
void inc (unsigned int count=1)
{
if (get_offset () + count <= str.length)
set_offset (get_offset () + count);
else
set_error ();
/* Automatically puts us in error if count is out-of-range. */
set_offset (get_offset () + count);
}
/* We (ab)use ubytes backwards_length as a cursor (called offset),