From dcce53ddcb52d10dca1ff1d3e118297175892c26 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 23 Nov 2022 13:19:38 -0700 Subject: [PATCH] [cff] Micro-optimize fetch_op --- src/hb-cff-interp-common.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh index a32496626..3f65335fc 100644 --- a/src/hb-cff-interp-common.hh +++ b/src/hb-cff-interp-common.hh @@ -305,6 +305,8 @@ struct byte_str_ref_t return str.arrayZ[get_offset () + i]; } + unsigned char head_unchecked () const { return str.arrayZ[get_offset ()]; } + /* Conversion to hb_ubytes_t */ operator hb_ubytes_t () const { return str.sub_array (get_offset ()); } @@ -576,12 +578,12 @@ struct interp_env_t op_code_t op = OpCode_Invalid; if (unlikely (!str_ref.avail ())) return OpCode_Invalid; - op = (op_code_t)(unsigned char)str_ref[0]; + op = (op_code_t) str_ref.head_unchecked (); str_ref.inc (); if (op == OpCode_escape) { if (unlikely (!str_ref.avail ())) return OpCode_Invalid; - op = Make_OpCode_ESC(str_ref[0]); + op = Make_OpCode_ESC (str_ref.head_unchecked ()); str_ref.inc (); } return op;