mirror of
https://github.com/NixOS/nix
synced 2025-07-08 06:53:54 +02:00
hash: Compare hash algo second for back compat
Previously (incfc18a7739
), we forgot to compare the algo at all. This means we keep the same ordering as before by making the stuff we always have compared take priority. (cherry picked from commit25a9894943
)
This commit is contained in:
parent
97253a92c2
commit
bbccb2fc43
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
Add a link
Reference in a new issue