Use assume

It works now that we fell back to the __builtin_unreachable based
implementation for gcc.
This commit is contained in:
2024-03-15 17:23:02 -07:00
parent e7719b6e0b
commit dfbb3ce5f1

View File

@@ -374,10 +374,8 @@ inline void Node16::copyChildrenAndKeyFrom(const Node48 &other) {
other.bitSet.forEachInRange(
[&](int c) {
// Suppress a false positive -Waggressive-loop-optimizations warning
// in gcc. `assume` doesn't work for some reason.
if (!(i < Node16::kMaxNodes)) {
__builtin_unreachable(); // GCOVR_EXCL_LINE
}
// in gcc
assume(i < Node16::kMaxNodes);
index[i] = c;
children[i] = other.children[other.index[c]];
assert(children[i].child->parent == &other);
@@ -430,10 +428,8 @@ inline void Node48::copyChildrenAndKeyFrom(const Node256 &other) {
bitSet.forEachInRange(
[&](int c) {
// Suppress a false positive -Waggressive-loop-optimizations warning
// in gcc. `assume` doesn't work for some reason.
if (!(i < Node48::kMaxNodes)) {
__builtin_unreachable(); // GCOVR_EXCL_LINE
}
// in gcc.
assume(i < Node48::kMaxNodes);
index[c] = i;
children[i] = other.children[c];
assert(children[i].child->parent == &other);