Use forEachInRange in setChildrenParents
This commit is contained in:
@@ -464,21 +464,13 @@ void setChildrenParents(Node16 *n) {
|
||||
}
|
||||
|
||||
void setChildrenParents(Node48 *n) {
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
int c = n->index[i];
|
||||
if (c != -1) {
|
||||
n->children[c].child->parent = n;
|
||||
}
|
||||
}
|
||||
n->bitSet.forEachInRange(
|
||||
[&](int i) { n->children[n->index[i]].child->parent = n; }, 0, 256);
|
||||
}
|
||||
|
||||
void setChildrenParents(Node256 *n) {
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
auto *child = n->children[i].child;
|
||||
if (child != nullptr) {
|
||||
child->parent = n;
|
||||
}
|
||||
}
|
||||
n->bitSet.forEachInRange([&](int i) { n->children[i].child->parent = n; }, 0,
|
||||
256);
|
||||
}
|
||||
|
||||
// Caller is responsible for assigning a non-null pointer to the returned
|
||||
|
Reference in New Issue
Block a user