From d58e248df62457bdc8a5bab743e5de26c6fc57be Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 29 Aug 2019 15:23:48 -0700 Subject: [PATCH] [array] Add truncate() method --- src/hb-array.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-array.hh b/src/hb-array.hh index 96d2e0a97..51994947e 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -181,6 +181,8 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> hb_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const { return sub_array (start_offset, &seg_count); } + hb_array_t truncate (unsigned length) const { return sub_array (0, length); } + template @@ -263,6 +265,8 @@ struct hb_sorted_array_t : hb_sorted_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const { return sub_array (start_offset, &seg_count); } + hb_sorted_array_t truncate (unsigned length) const { return sub_array (0, length); } + template Type *bsearch (const T &x, Type *not_found = nullptr) {