diff --git a/src/hb-array.hh b/src/hb-array.hh index 75805805b..760f90259 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -76,11 +76,24 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> typedef Type& __item_t__; static constexpr bool is_random_access_iterator = true; static constexpr bool has_fast_len = true; + Type& __item__ () const + { + if (unlikely (!length)) return CrapOrNull (Type); + return *arrayZ; + } Type& __item_at__ (unsigned i) const { if (unlikely (i >= length)) return CrapOrNull (Type); return arrayZ[i]; } + void __next__ () + { + if (unlikely (!length)) + return; + length--; + backwards_length++; + arrayZ++; + } void __forward__ (unsigned n) { if (unlikely (n > length)) @@ -89,6 +102,14 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> backwards_length += n; arrayZ += n; } + void __prev__ () + { + if (unlikely (!backwards_length)) + return; + length++; + backwards_length--; + arrayZ--; + } void __rewind__ (unsigned n) { if (unlikely (n > backwards_length))