Use forEachInRange for overfill for Node48

This commit is contained in:
2024-02-26 10:55:50 -08:00
parent 17ac9b38fb
commit 333ac74d91

View File

@@ -558,12 +558,11 @@ Node *&getOrCreateChild(Node *&self, uint8_t index,
auto *newSelf = allocators->node256.allocate();
memcpy((void *)newSelf, self, offsetof(Node, type));
newSelf->bitSet = self48->bitSet;
for (int i = 0; i < 256; ++i) {
int c = self48->index[i];
if (c >= 0) {
newSelf->children[i] = self48->children[c];
}
}
newSelf->bitSet.forEachInRange(
[&](int i) {
newSelf->children[i] = self48->children[self48->index[i]];
},
0, 256);
allocators->node48.release(self48);
setChildrenParents(newSelf);
self = newSelf;