Save more instructions in getOrCreateChild
Take advantage of the property that Node4 is a prefix of Node16
This commit is contained in:
@@ -408,9 +408,8 @@ Node *&getOrCreateChild(Node *&self, uint8_t index,
|
|||||||
|
|
||||||
if (self->numChildren == 4) {
|
if (self->numChildren == 4) {
|
||||||
auto *newSelf = allocators->node16.allocate();
|
auto *newSelf = allocators->node16.allocate();
|
||||||
memcpy((void *)newSelf, self, offsetof(Node, type));
|
memcpy((void *)newSelf, self, sizeof(Node4));
|
||||||
memcpy(newSelf->index, self4->index, 4);
|
newSelf->type = Type::Node16;
|
||||||
memcpy(newSelf->children, self4->children, 4 * sizeof(void *));
|
|
||||||
allocators->node4.release(self4);
|
allocators->node4.release(self4);
|
||||||
self = newSelf;
|
self = newSelf;
|
||||||
setChildrenParents(self);
|
setChildrenParents(self);
|
||||||
|
Reference in New Issue
Block a user