diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 86a74ccb6..82ace31bb 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -716,9 +716,7 @@ struct CoverageFormat1 template inline void add_coverage (set_t *glyphs) const { - unsigned int count = glyphArray.len; - for (unsigned int i = 0; i < count; i++) - glyphs->add (glyphArray[i]); + glyphs->add_array (glyphArray.array, glyphArray.len); } public: diff --git a/src/hb-set-digest-private.hh b/src/hb-set-digest-private.hh index 9135136c0..750870855 100644 --- a/src/hb-set-digest-private.hh +++ b/src/hb-set-digest-private.hh @@ -80,6 +80,12 @@ struct hb_set_digest_lowest_bits_t mask |= mb + (mb - ma) - (mb < ma); } } + template + inline void add_array (const T *array, unsigned int count) + { + for (unsigned int i = 0; i < count; i++) + add (array[i]); + } inline bool may_have (hb_codepoint_t g) const { return !!(mask & mask_for (g)); @@ -112,6 +118,12 @@ struct hb_set_digest_combiner_t head.add_range (a, b); tail.add_range (a, b); } + template + inline void add_array (const T *array, unsigned int count) + { + head.add_array (array, count); + tail.add_array (array, count); + } inline bool may_have (hb_codepoint_t g) const { return head.may_have (g) && tail.may_have (g); diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index 5971e9b7a..e3048657a 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -248,6 +248,12 @@ struct hb_set_t page->add_range (major_start (mb), b); } } + template + inline void add_array (const T *array, unsigned int count) + { + for (unsigned int i = 0; i < count; i++) + add (array[i]); + } inline void del (hb_codepoint_t g) { if (unlikely (in_error)) return;