Simplify nextPhysical
This commit is contained in:
@@ -1257,44 +1257,9 @@ Node *&getOrCreateChild(Node *&self, uint8_t index, WriteContext *tls) {
|
||||
Node *nextPhysical(Node *node) {
|
||||
int index = -1;
|
||||
for (;;) {
|
||||
switch (node->getType()) {
|
||||
case Type_Node0: {
|
||||
auto *n = static_cast<Node0 *>(node);
|
||||
auto nextChild = getChildGeq(n, index + 1);
|
||||
if (nextChild != nullptr) {
|
||||
return nextChild;
|
||||
}
|
||||
} break;
|
||||
case Type_Node3: {
|
||||
auto *n = static_cast<Node3 *>(node);
|
||||
auto nextChild = getChildGeq(n, index + 1);
|
||||
if (nextChild != nullptr) {
|
||||
return nextChild;
|
||||
}
|
||||
} break;
|
||||
case Type_Node16: {
|
||||
auto *n = static_cast<Node16 *>(node);
|
||||
auto nextChild = getChildGeq(n, index + 1);
|
||||
if (nextChild != nullptr) {
|
||||
return nextChild;
|
||||
}
|
||||
} break;
|
||||
case Type_Node48: {
|
||||
auto *n = static_cast<Node48 *>(node);
|
||||
auto nextChild = getChildGeq(n, index + 1);
|
||||
if (nextChild != nullptr) {
|
||||
return nextChild;
|
||||
}
|
||||
} break;
|
||||
case Type_Node256: {
|
||||
auto *n = static_cast<Node256 *>(node);
|
||||
auto nextChild = getChildGeq(n, index + 1);
|
||||
if (nextChild != nullptr) {
|
||||
return nextChild;
|
||||
}
|
||||
} break;
|
||||
default: // GCOVR_EXCL_LINE
|
||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||
auto nextChild = getChildGeq(node, index + 1);
|
||||
if (nextChild != nullptr) {
|
||||
return nextChild;
|
||||
}
|
||||
index = node->parentsIndex;
|
||||
node = node->parent;
|
||||
|
Reference in New Issue
Block a user