提交 639afdc6 编写于 作者: B Behdad Esfahbod

Minor

上级 95212100
...@@ -321,14 +321,22 @@ struct hb_prealloced_array_t ...@@ -321,14 +321,22 @@ struct hb_prealloced_array_t
inline void pop (void) inline void pop (void)
{ {
len--; len--;
/* TODO: shrink array if needed */ }
inline void remove (unsigned int i)
{
if (unlikely (i >= len))
return;
memmove (static_cast<void *> (&array[i]),
static_cast<void *> (&array[i + 1]),
(len - i - 1) * sizeof (Type));
len--;
} }
inline void shrink (unsigned int l) inline void shrink (unsigned int l)
{ {
if (l < len) if (l < len)
len = l; len = l;
/* TODO: shrink array if needed */
} }
template <typename T> template <typename T>
...@@ -376,7 +384,7 @@ struct hb_prealloced_array_t ...@@ -376,7 +384,7 @@ struct hb_prealloced_array_t
} }
}; };
#define HB_AUTO_ARRAY_PREALLOCED 64 #define HB_AUTO_ARRAY_PREALLOCED 16
template <typename Type> template <typename Type>
struct hb_auto_array_t : hb_prealloced_array_t <Type, HB_AUTO_ARRAY_PREALLOCED> struct hb_auto_array_t : hb_prealloced_array_t <Type, HB_AUTO_ARRAY_PREALLOCED>
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册