Use statically-known numChildren in Node3 -> Node16

This commit is contained in:
2024-03-15 16:49:45 -07:00
parent e9c8537cf2
commit a79436ee9b

View File

@@ -348,7 +348,8 @@ inline void Node16::copyChildrenAndKeyFrom(const Node3 &other) {
memcpy(index, other.index, Node3::kMaxNodes); memcpy(index, other.index, Node3::kMaxNodes);
memcpy(children, other.children, Node3::kMaxNodes * sizeof(Child)); memcpy(children, other.children, Node3::kMaxNodes * sizeof(Child));
memcpy(partialKey(), &other + 1, partialKeyLen); memcpy(partialKey(), &other + 1, partialKeyLen);
for (int i = 0; i < numChildren; ++i) { assert(numChildren == Node3::kMaxNodes);
for (int i = 0; i < Node3::kMaxNodes; ++i) {
assert(children[i].child->parent == &other); assert(children[i].child->parent == &other);
children[i].child->parent = this; children[i].child->parent = this;
} }