diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index b2cf8ce17..2ccc094bc 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -642,45 +642,36 @@ struct hb_serialize_context_t */ template -struct Supplier +struct Supplier : hb_array_t { Supplier (const Type *array, unsigned int len_) { - head = array; - len = len_; + this->arrayZ = array; + this->len = len_; } Supplier (hb_array_t v) { - head = v.arrayZ; - len = v.len; + this->arrayZ = v.arrayZ; + this->len = v.len; } Supplier (const hb_vector_t &v) { - head = (const Type *) v; - len = v.len; - } - - const Type operator [] (unsigned int i) const - { - if (unlikely (i >= len)) return Type (); - return head[i]; + this->arrayZ = (const Type *) v; + this->len = v.len; } Supplier & operator += (unsigned int count) { - if (unlikely (count > len)) - count = len; - len -= count; - head += 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 */ - - unsigned int len; - const Type *head; };