From f85f6e815f439075f8c6f5391e5c8dfe77e0f00d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 16 Dec 2018 23:45:07 -0500 Subject: [PATCH] [array] Add operator += --- src/hb-array.hh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hb-array.hh b/src/hb-array.hh index 61037e2a6..1c5dc01e9 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -57,6 +57,15 @@ struct hb_array_t Type * operator & (void) const { return arrayZ; } + hb_array_t & operator += (unsigned int count) + { + if (unlikely (count > len)) + count = len; + len -= count; + arrayZ += count; + return *this; + } + unsigned int get_size (void) const { return len * item_size; } hb_array_t sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const @@ -241,15 +250,6 @@ struct Supplier : hb_array_t this->len = v.len; } - Supplier & operator += (unsigned int count) - { - if (unlikely (count > this->len)) - count = this->len; - this->len -= count; - this->arrayZ += count; - return *this; - } - private: Supplier (const Supplier &); /* Disallow copy */ Supplier& operator= (const Supplier &); /* Disallow copy */