[arrays] Remove unused stride from Supplier

This commit is contained in:
Behdad Esfahbod 2018-12-16 22:30:44 -05:00
parent 0d0fe9df46
commit 1e2c98126e
1 changed files with 3 additions and 7 deletions

View File

@ -644,29 +644,26 @@ struct hb_serialize_context_t
template <typename Type> template <typename Type>
struct Supplier struct Supplier
{ {
Supplier (const Type *array, unsigned int len_, unsigned int stride_=sizeof (Type)) Supplier (const Type *array, unsigned int len_)
{ {
head = array; head = array;
len = len_; len = len_;
stride = stride_;
} }
Supplier (hb_array_t<const Type> v) Supplier (hb_array_t<const Type> v)
{ {
head = v.arrayZ; head = v.arrayZ;
len = v.len; len = v.len;
stride = sizeof (Type);
} }
Supplier (const hb_vector_t<Type> &v) Supplier (const hb_vector_t<Type> &v)
{ {
head = (const Type *) v; head = (const Type *) v;
len = v.len; len = v.len;
stride = sizeof (Type);
} }
const Type operator [] (unsigned int i) const const Type operator [] (unsigned int i) const
{ {
if (unlikely (i >= len)) return Type (); if (unlikely (i >= len)) return Type ();
return * (const Type *) (const void *) ((const char *) head + stride * i); return head[i];
} }
Supplier<Type> & operator += (unsigned int count) Supplier<Type> & operator += (unsigned int count)
@ -674,7 +671,7 @@ struct Supplier
if (unlikely (count > len)) if (unlikely (count > len))
count = len; count = len;
len -= count; len -= count;
head = (const Type *) (const void *) ((const char *) head + stride * count); head += count;
return *this; return *this;
} }
@ -683,7 +680,6 @@ struct Supplier
Supplier<Type>& operator= (const Supplier<Type> &); /* Disallow copy */ Supplier<Type>& operator= (const Supplier<Type> &); /* Disallow copy */
unsigned int len; unsigned int len;
unsigned int stride;
const Type *head; const Type *head;
}; };