Remove redundant work

This commit is contained in:
2024-01-23 10:29:33 -08:00
parent 836766132f
commit d68bd52122

View File

@@ -734,12 +734,8 @@ Node *&getOrCreateChild(Node *&self, uint8_t index) {
memcpy(newSelf, self, offsetof(Node, type));
memcpy(newSelf->index, self4->index, 4);
memcpy(newSelf->children, self4->children, 4 * sizeof(void *));
free(self);
self = newSelf;
free(std::exchange(self, newSelf));
setChildrenParents(self);
if (newSelf->parent) {
getOrCreateChild(newSelf->parent, newSelf->parentsIndex) = newSelf;
}
goto insert16;
} else {
++self->numChildren;
@@ -778,12 +774,8 @@ Node *&getOrCreateChild(Node *&self, uint8_t index) {
++i;
}
assert(i == 16);
free(self);
self = newSelf;
free(std::exchange(self, newSelf));
setChildrenParents(self);
if (newSelf->parent) {
getOrCreateChild(newSelf->parent, newSelf->parentsIndex) = newSelf;
}
goto insert48;
} else {
++self->numChildren;
@@ -817,12 +809,9 @@ Node *&getOrCreateChild(Node *&self, uint8_t index) {
newSelf->children[i] = self48->children[self48->index[i]];
}
}
free(self);
free(std::exchange(self, newSelf));
self = newSelf;
setChildrenParents(self);
if (newSelf->parent) {
getOrCreateChild(newSelf->parent, newSelf->parentsIndex) = newSelf;
}
goto insert256;
} else {
++self->numChildren;