Process acceptable subranges interleaved

This commit is contained in:
2024-10-29 14:41:42 -07:00
parent c06afeb81e
commit 7aac73ee80
3 changed files with 82 additions and 28 deletions

View File

@@ -49,6 +49,17 @@ operator<=>(const std::span<const uint8_t> &lhs,
return lhs.size() <=> size_t(rhs.len);
}
[[nodiscard]] inline auto operator<=>(const ConflictSet::Key &lhs,
const ConflictSet::Key &rhs) noexcept {
int cl = std::min<int>(lhs.len, rhs.len);
if (cl > 0) {
if (auto c = memcmp(lhs.p, rhs.p, cl) <=> 0; c != 0) {
return c;
}
}
return lhs.len <=> rhs.len;
}
// This header contains code that we want to reuse outside of ConflictSet.cpp or
// want to exclude from coverage since it's only testing related.