Write Node16 scan in a "more vectorized" style

This commit is contained in:
2024-06-27 12:07:38 -07:00
parent bff7b85de2
commit 1b4b61ddc6

View File

@@ -1755,12 +1755,17 @@ bool checkMaxBetweenExclusive(Node *n, int begin, int end,
} break; } break;
case Type_Node16: { case Type_Node16: {
auto *self = static_cast<Node16 *>(n); auto *self = static_cast<Node16 *>(n);
bool result = true; uint32_t compared = 0;
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
result &= !((self->childMaxVersion[i] > readVersion) & compared |= ((self->childMaxVersion[i] > readVersion) << i);
inBounds(self->index[i]));
} }
return result;
uint32_t mask = 0;
for (int i = 0; i < 16; ++i) {
mask |= inBounds(self->index[i]) << i;
}
return !(compared & mask);
} break; } break;
case Type_Node48: { case Type_Node48: {
auto *self = static_cast<Node48 *>(n); auto *self = static_cast<Node48 *>(n);