Commit 9c1c180a authored by Max Kellermann's avatar Max Kellermann

tag/Item: declare value[] to have only one element

By declaring the variable-length array to have a nominal size of 1, struct TagPoolSlot shrinks from 24 bytes to 16 bytes, because "ref" and "item" now both fit in one machine word.
parent 06682bd2
...@@ -34,13 +34,14 @@ struct TagItem { ...@@ -34,13 +34,14 @@ struct TagItem {
/** /**
* the value of this tag; this is a variable length string * the value of this tag; this is a variable length string
*/ */
char value[sizeof(long) - sizeof(type)]; char value[1];
TagItem() = default; TagItem() = default;
TagItem(const TagItem &other) = delete; TagItem(const TagItem &other) = delete;
TagItem &operator=(const TagItem &other) = delete; TagItem &operator=(const TagItem &other) = delete;
}; };
static_assert(sizeof(TagItem) == 2, "Unexpected size");
static_assert(alignof(TagItem) == 1, "Unexpected alignment"); static_assert(alignof(TagItem) == 1, "Unexpected alignment");
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment