From e5e3bc4080cfdb6d3fd76796555144e17697c4ae Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 6 Feb 2025 02:36:26 +0000 Subject: [PATCH] [buffer] Merge two functions into a template --- src/hb-aat-layout-common.hh | 2 +- src/hb-buffer.hh | 11 +++-------- src/hb-ot-layout-gsubgpos.hh | 2 +- src/hb-ot-layout.cc | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index e53a78e0b..21edb5664 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -93,7 +93,7 @@ struct hb_aat_apply_context_t : using_buffer_glyph_set = buffer->len >= 4; if (using_buffer_glyph_set) - buffer_glyph_set = buffer->bit_set (); + buffer_glyph_set = buffer->collect_codepoints (); } bool buffer_intersects_machine () const { diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index f0a852a73..15d82de47 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -198,15 +198,10 @@ struct hb_buffer_t __attribute__((always_inline)) hb_glyph_info_t prev () const { return out_info[out_len ? out_len - 1 : 0]; } - hb_set_digest_t digest () const + template + set_t collect_codepoints () const { - hb_set_digest_t d; - d.add_array (&info[0].codepoint, len, sizeof (info[0])); - return d; - } - hb_bit_set_t bit_set () const - { - hb_bit_set_t d; + set_t d; d.add_array (&info[0].codepoint, len, sizeof (info[0])); return d; } diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 99d0b385a..5a521d15f 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -763,7 +763,7 @@ struct hb_ot_apply_context_t : nullptr #endif ), - digest (buffer_->digest ()), + digest (buffer_->collect_codepoints ()), direction (buffer_->props.direction), has_glyph_classes (gdef.has_glyph_classes ()) { init_iters (); } diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 2ba09809a..fc29250f9 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -2059,7 +2059,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, if (stage->pause_func (plan, font, buffer)) { /* Refresh working buffer digest since buffer changed. */ - c.digest = buffer->digest (); + c.digest = buffer->collect_codepoints (); } } }