From adb8fdc5e9c34fc573410fffd521eaa3a702e60d Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 1 Aug 2024 14:00:02 -0700 Subject: [PATCH] Simplify nextPhysical --- ConflictSet.cpp | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 2272d95..bfb683a 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -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(node); - auto nextChild = getChildGeq(n, index + 1); - if (nextChild != nullptr) { - return nextChild; - } - } break; - case Type_Node3: { - auto *n = static_cast(node); - auto nextChild = getChildGeq(n, index + 1); - if (nextChild != nullptr) { - return nextChild; - } - } break; - case Type_Node16: { - auto *n = static_cast(node); - auto nextChild = getChildGeq(n, index + 1); - if (nextChild != nullptr) { - return nextChild; - } - } break; - case Type_Node48: { - auto *n = static_cast(node); - auto nextChild = getChildGeq(n, index + 1); - if (nextChild != nullptr) { - return nextChild; - } - } break; - case Type_Node256: { - auto *n = static_cast(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;