Remove redundant work
This commit is contained in:
@@ -734,12 +734,8 @@ Node *&getOrCreateChild(Node *&self, uint8_t index) {
|
|||||||
memcpy(newSelf, self, offsetof(Node, type));
|
memcpy(newSelf, self, offsetof(Node, type));
|
||||||
memcpy(newSelf->index, self4->index, 4);
|
memcpy(newSelf->index, self4->index, 4);
|
||||||
memcpy(newSelf->children, self4->children, 4 * sizeof(void *));
|
memcpy(newSelf->children, self4->children, 4 * sizeof(void *));
|
||||||
free(self);
|
free(std::exchange(self, newSelf));
|
||||||
self = newSelf;
|
|
||||||
setChildrenParents(self);
|
setChildrenParents(self);
|
||||||
if (newSelf->parent) {
|
|
||||||
getOrCreateChild(newSelf->parent, newSelf->parentsIndex) = newSelf;
|
|
||||||
}
|
|
||||||
goto insert16;
|
goto insert16;
|
||||||
} else {
|
} else {
|
||||||
++self->numChildren;
|
++self->numChildren;
|
||||||
@@ -778,12 +774,8 @@ Node *&getOrCreateChild(Node *&self, uint8_t index) {
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
assert(i == 16);
|
assert(i == 16);
|
||||||
free(self);
|
free(std::exchange(self, newSelf));
|
||||||
self = newSelf;
|
|
||||||
setChildrenParents(self);
|
setChildrenParents(self);
|
||||||
if (newSelf->parent) {
|
|
||||||
getOrCreateChild(newSelf->parent, newSelf->parentsIndex) = newSelf;
|
|
||||||
}
|
|
||||||
goto insert48;
|
goto insert48;
|
||||||
} else {
|
} else {
|
||||||
++self->numChildren;
|
++self->numChildren;
|
||||||
@@ -817,12 +809,9 @@ Node *&getOrCreateChild(Node *&self, uint8_t index) {
|
|||||||
newSelf->children[i] = self48->children[self48->index[i]];
|
newSelf->children[i] = self48->children[self48->index[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(self);
|
free(std::exchange(self, newSelf));
|
||||||
self = newSelf;
|
self = newSelf;
|
||||||
setChildrenParents(self);
|
setChildrenParents(self);
|
||||||
if (newSelf->parent) {
|
|
||||||
getOrCreateChild(newSelf->parent, newSelf->parentsIndex) = newSelf;
|
|
||||||
}
|
|
||||||
goto insert256;
|
goto insert256;
|
||||||
} else {
|
} else {
|
||||||
++self->numChildren;
|
++self->numChildren;
|
||||||
|
Reference in New Issue
Block a user