Change firstGeq to compare to param1

This commit is contained in:
2024-05-15 16:31:34 -07:00
parent 464d720a6b
commit 007160098e
4 changed files with 26 additions and 9 deletions

View File

@@ -390,6 +390,17 @@ auto operator<=>(const VersionedMap::Key &lhs, const Node &rhs) {
return lhs.len <=> rhs.entry->keyLen;
}
auto operator<=>(const VersionedMap::Key &lhs, const VersionedMap::Key &rhs) {
int cl = std::min(lhs.len, rhs.len);
if (cl > 0) {
int c = memcmp(lhs.p, rhs.p, cl);
if (c != 0) {
return c <=> 0;
}
}
return lhs.len <=> rhs.len;
}
constexpr int orderToInt(std::strong_ordering o) {
return o == std::strong_ordering::less ? -1
: o == std::strong_ordering::equal ? 0
@@ -1156,6 +1167,11 @@ void VersionedMap::Impl::firstGeq(const Key *key, const int64_t *version,
} else {
iterator[i].impl->mutationIndex = 0;
}
auto m = *iterator[i];
if (Key{m.param1, m.param1Len} < key[i]) {
++iterator[i];
}
}
}