提交 f3a74c16 编写于 作者: B Behdad Esfahbod

Make hb_vector_t 8 bytes smaller

上级 44999f8b
...@@ -450,8 +450,7 @@ template <typename Type, unsigned int StaticSize=8> ...@@ -450,8 +450,7 @@ template <typename Type, unsigned int StaticSize=8>
struct hb_vector_t struct hb_vector_t
{ {
unsigned int len; unsigned int len;
unsigned int allocated; unsigned int allocated; /* == 0 means allocation failed. */
bool successful;
Type *arrayZ; Type *arrayZ;
Type static_array[StaticSize]; Type static_array[StaticSize];
...@@ -459,7 +458,6 @@ struct hb_vector_t ...@@ -459,7 +458,6 @@ struct hb_vector_t
{ {
len = 0; len = 0;
allocated = ARRAY_LENGTH (static_array); allocated = ARRAY_LENGTH (static_array);
successful = true;
arrayZ = static_array; arrayZ = static_array;
} }
...@@ -492,7 +490,7 @@ struct hb_vector_t ...@@ -492,7 +490,7 @@ struct hb_vector_t
/* Allocate for size but don't adjust len. */ /* Allocate for size but don't adjust len. */
inline bool alloc (unsigned int size) inline bool alloc (unsigned int size)
{ {
if (unlikely (!successful)) if (unlikely (!allocated))
return false; return false;
if (likely (size <= allocated)) if (likely (size <= allocated))
...@@ -521,7 +519,7 @@ struct hb_vector_t ...@@ -521,7 +519,7 @@ struct hb_vector_t
if (unlikely (!new_array)) if (unlikely (!new_array))
{ {
successful = false; allocated = 0;
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册