mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-16 15:17:18 +02:00
Merge pull request #10900 from obsidiansystems/hash-order
hash: Compare hash algo second for back compat
This commit is contained in:
commit
afdd12be5e
1 changed files with 1 additions and 1 deletions
|
@ -52,11 +52,11 @@ bool Hash::operator == (const Hash & h2) const
|
||||||
|
|
||||||
std::strong_ordering Hash::operator <=> (const Hash & h) const
|
std::strong_ordering Hash::operator <=> (const Hash & h) const
|
||||||
{
|
{
|
||||||
if (auto cmp = algo <=> h.algo; cmp != 0) return cmp;
|
|
||||||
if (auto cmp = hashSize <=> h.hashSize; cmp != 0) return cmp;
|
if (auto cmp = hashSize <=> h.hashSize; cmp != 0) return cmp;
|
||||||
for (unsigned int i = 0; i < hashSize; i++) {
|
for (unsigned int i = 0; i < hashSize; i++) {
|
||||||
if (auto cmp = hash[i] <=> h.hash[i]; cmp != 0) return cmp;
|
if (auto cmp = hash[i] <=> h.hash[i]; cmp != 0) return cmp;
|
||||||
}
|
}
|
||||||
|
if (auto cmp = algo <=> h.algo; cmp != 0) return cmp;
|
||||||
return std::strong_ordering::equivalent;
|
return std::strong_ordering::equivalent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue