Simplify more "down left spine" loops

This commit is contained in:
2024-08-01 13:13:55 -07:00
parent 988ec5ce69
commit be67555756

View File

@@ -2513,14 +2513,9 @@ bool checkRangeStartsWith(Node *n, std::span<const uint8_t> key, int begin,
__builtin_unreachable(); // GCOVR_EXCL_LINE __builtin_unreachable(); // GCOVR_EXCL_LINE
downLeftSpine: downLeftSpine:
for (;;) { for (; !n->entryPresent; n = getFirstChildExists(n)) {
if (n->entryPresent) { }
return n->entry.rangeVersion <= readVersion; return n->entry.rangeVersion <= readVersion;
}
int c = getChildGeq(n, 0);
assert(c >= 0);
n = getChildExists(n, c);
}
} }
namespace { namespace {
@@ -2633,16 +2628,11 @@ template <bool kAVX512> struct CheckRangeLeftSide {
} }
bool downLeftSpine() { bool downLeftSpine() {
for (;;) { for (; !n->entryPresent; n = getFirstChildExists(n)) {
if (n->entryPresent) { }
ok = n->entry.rangeVersion <= readVersion; ok = n->entry.rangeVersion <= readVersion;
return true; return true;
} }
int c = getChildGeq(n, 0);
assert(c >= 0);
n = getChildExists(n, c);
}
}
}; };
// Return true if the max version among all keys that start with key[:prefixLen] // Return true if the max version among all keys that start with key[:prefixLen]
@@ -2770,16 +2760,11 @@ template <bool kAVX512> struct CheckRangeRightSide {
} }
bool downLeftSpine() { bool downLeftSpine() {
for (;;) { for (; !n->entryPresent; n = getFirstChildExists(n)) {
if (n->entryPresent) { }
ok = n->entry.rangeVersion <= readVersion; ok = n->entry.rangeVersion <= readVersion;
return true; return true;
} }
int c = getChildGeq(n, 0);
assert(c >= 0);
n = getChildExists(n, c);
}
}
}; };
} // namespace } // namespace