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) {
|
||||
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);
|
||||
|
Reference in New Issue
Block a user