Compare commits
2 Commits
587874841f
...
45da8fb996
| Author | SHA1 | Date | |
|---|---|---|---|
| 45da8fb996 | |||
| 4958a4cced |
@@ -1850,9 +1850,9 @@ bool scan16(const InternalVersionT *vs, const uint8_t *is, int begin, int end,
|
||||
// Returns true if v[i] <= readVersion for all i such that begin <= i < end
|
||||
//
|
||||
// always_inline So that we can optimize when begin or end is a constant.
|
||||
__attribute((always_inline)) bool scan16(const InternalVersionT *vs, int begin,
|
||||
int end,
|
||||
InternalVersionT readVersion) {
|
||||
inline __attribute((always_inline)) bool scan16(const InternalVersionT *vs,
|
||||
int begin, int end,
|
||||
InternalVersionT readVersion) {
|
||||
assert(0 <= begin && begin < 16);
|
||||
assert(0 <= end && end <= 16);
|
||||
assert(begin <= end);
|
||||
@@ -1923,29 +1923,34 @@ bool checkMaxBetweenExclusive(Node *n, int begin, int end,
|
||||
// [begin, end) is now the half-open interval of children we're interested in.
|
||||
assert(begin < end);
|
||||
|
||||
const unsigned shiftUpperBound = end - begin;
|
||||
const unsigned shiftAmount = begin;
|
||||
auto inBounds = [&](unsigned c) { return c - shiftAmount < shiftUpperBound; };
|
||||
|
||||
switch (n->getType()) {
|
||||
case Type_Node0: // GCOVR_EXCL_LINE
|
||||
// We would have returned above, after not finding a child
|
||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||
case Type_Node3: {
|
||||
auto *self = static_cast<Node3 *>(n);
|
||||
bool result = true;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
result &= !((self->childMaxVersion[i] > readVersion) &&
|
||||
inBounds(self->index[i]));
|
||||
|
||||
const unsigned shiftUpperBound = end - begin;
|
||||
const unsigned shiftAmount = begin;
|
||||
auto inBounds = [&](unsigned c) {
|
||||
return c - shiftAmount < shiftUpperBound;
|
||||
};
|
||||
|
||||
uint32_t compared = 0;
|
||||
for (int i = 0; i < Node3::kMaxNodes; ++i) {
|
||||
compared |= (self->childMaxVersion[i] > readVersion) << i;
|
||||
}
|
||||
return result;
|
||||
} break;
|
||||
uint32_t mask = 0;
|
||||
for (int i = 0; i < Node3::kMaxNodes; ++i) {
|
||||
mask |= inBounds(self->index[i]) << i;
|
||||
}
|
||||
return !(compared & mask);
|
||||
}
|
||||
case Type_Node16: {
|
||||
auto *self = static_cast<Node16 *>(n);
|
||||
|
||||
return scan16(self->childMaxVersion, self->index, begin, end, readVersion);
|
||||
|
||||
} break;
|
||||
}
|
||||
case Type_Node48: {
|
||||
auto *self = static_cast<Node48 *>(n);
|
||||
// Check all pages
|
||||
|
||||
Reference in New Issue
Block a user