diff --git a/src/hb-private.hh b/src/hb-private.hh index 13465c634..4152e2755 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -321,14 +321,22 @@ struct hb_prealloced_array_t inline void pop (void) { len--; - /* TODO: shrink array if needed */ + } + + inline void remove (unsigned int i) + { + if (unlikely (i >= len)) + return; + memmove (static_cast (&array[i]), + static_cast (&array[i + 1]), + (len - i - 1) * sizeof (Type)); + len--; } inline void shrink (unsigned int l) { if (l < len) len = l; - /* TODO: shrink array if needed */ } template @@ -376,7 +384,7 @@ struct hb_prealloced_array_t } }; -#define HB_AUTO_ARRAY_PREALLOCED 64 +#define HB_AUTO_ARRAY_PREALLOCED 16 template struct hb_auto_array_t : hb_prealloced_array_t {