From b00a911fa721598b1b7c44943790671506091542 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 21 Nov 2022 12:11:30 -0700 Subject: [PATCH] [sorted-array] Add faster iterator implementation here as well --- src/hb-array.hh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hb-array.hh b/src/hb-array.hh index bd3d5af64..d4dbefd95 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -327,6 +327,11 @@ struct hb_sorted_array_t : bool operator != (const hb_sorted_array_t& o) const { return this->arrayZ != o.arrayZ || this->length != o.length; } + /* Faster range-based for loop without bounds-check. */ + Type *begin () const { return this->arrayZ; } + Type *end () const { return this->arrayZ + this->length; } + + hb_sorted_array_t sub_array (unsigned int start_offset, unsigned int *seg_count /* IN/OUT */) const { return hb_sorted_array_t (((const hb_array_t *) (this))->sub_array (start_offset, seg_count)); } hb_sorted_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const