Reorder some Node fields

This commit is contained in:
2024-03-08 13:33:38 -08:00
parent 2989866a6d
commit 43a768d152

View File

@@ -173,10 +173,6 @@ constexpr static int kPartialKeyMaxLenEntryPresent = 24;
struct Node { struct Node {
/* begin section that's copied to the next node */ /* begin section that's copied to the next node */
bool entryPresent = false;
uint8_t parentsIndex = 0;
int8_t partialKeyLen = 0;
int32_t numChildren = 0;
Node *parent = nullptr; Node *parent = nullptr;
union { union {
uint8_t partialKey[kPartialKeyMaxLenEntryPresent + sizeof(Entry)]; uint8_t partialKey[kPartialKeyMaxLenEntryPresent + sizeof(Entry)];
@@ -185,12 +181,16 @@ struct Node {
Entry entry; Entry entry;
}; };
}; };
int32_t partialKeyLen = 0;
int16_t numChildren : 15 = 0;
bool entryPresent : 1 = false;
uint8_t parentsIndex = 0;
/* end section that's copied to the next node */ /* end section that's copied to the next node */
Type type; Type type;
}; };
constexpr int kNodeCopyBegin = offsetof(Node, entryPresent); constexpr int kNodeCopyBegin = offsetof(Node, parent);
constexpr int kNodeCopySize = offsetof(Node, type) - kNodeCopyBegin; constexpr int kNodeCopySize = offsetof(Node, type) - kNodeCopyBegin;
static_assert(offsetof(Node, entry) == static_assert(offsetof(Node, entry) ==