Save more instructions in getOrCreateChild

Take advantage of the property that Node4 is a prefix of Node16
This commit is contained in:
2024-02-23 12:39:24 -08:00
parent 116c79d3de
commit 7136b5a450

View File

@@ -408,9 +408,8 @@ Node *&getOrCreateChild(Node *&self, uint8_t index,
if (self->numChildren == 4) {
auto *newSelf = allocators->node16.allocate();
memcpy((void *)newSelf, self, offsetof(Node, type));
memcpy(newSelf->index, self4->index, 4);
memcpy(newSelf->children, self4->children, 4 * sizeof(void *));
memcpy((void *)newSelf, self, sizeof(Node4));
newSelf->type = Type::Node16;
allocators->node4.release(self4);
self = newSelf;
setChildrenParents(self);