Simplify nextPhysical
This commit is contained in:
@@ -1257,44 +1257,9 @@ Node *&getOrCreateChild(Node *&self, uint8_t index, WriteContext *tls) {
|
|||||||
Node *nextPhysical(Node *node) {
|
Node *nextPhysical(Node *node) {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
switch (node->getType()) {
|
auto nextChild = getChildGeq(node, index + 1);
|
||||||
case Type_Node0: {
|
if (nextChild != nullptr) {
|
||||||
auto *n = static_cast<Node0 *>(node);
|
return nextChild;
|
||||||
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
|
|
||||||
}
|
}
|
||||||
index = node->parentsIndex;
|
index = node->parentsIndex;
|
||||||
node = node->parent;
|
node = node->parent;
|
||||||
|
Reference in New Issue
Block a user