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(); auto *newSelf = allocators->node256.allocate();
memcpy((void *)newSelf, self, offsetof(Node, type)); memcpy((void *)newSelf, self, offsetof(Node, type));
newSelf->bitSet = self48->bitSet; newSelf->bitSet = self48->bitSet;
for (int i = 0; i < 256; ++i) { newSelf->bitSet.forEachInRange(
int c = self48->index[i]; [&](int i) {
if (c >= 0) { newSelf->children[i] = self48->children[self48->index[i]];
newSelf->children[i] = self48->children[c]; },
} 0, 256);
}
allocators->node48.release(self48); allocators->node48.release(self48);
setChildrenParents(newSelf); setChildrenParents(newSelf);
self = newSelf; self = newSelf;