From f73982a6992445141ea7ca402d1f4fea80f151c4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 15 Mar 2021 14:52:19 -0600 Subject: [PATCH] [buffer] Implement replace_glyph() in terms of replace_glyphs(1,1) I get exact same binary size with this, suggesting that compiler is optimizing these as needed. --- src/hb-buffer.hh | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 1a5229c57..7b4e92985 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -237,18 +237,8 @@ struct hb_buffer_t } HB_NODISCARD bool replace_glyph (hb_codepoint_t glyph_index) - { - if (unlikely (out_info != info || out_len != idx)) - { - if (unlikely (!make_room_for (1, 1))) return false; - out_info[out_len] = info[idx]; - } - out_info[out_len].codepoint = glyph_index; + { return replace_glyphs (1, 1, &glyph_index); } - idx++; - out_len++; - return true; - } /* Makes a copy of the glyph at idx to output and replace glyph_index */ HB_NODISCARD bool output_glyph (hb_codepoint_t glyph_index) { return replace_glyphs (0, 1, &glyph_index); }