mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 16:03:03 +02:00
Fixed comparing of credits amount with different types.
This commit is contained in:
parent
a11d3efed6
commit
d1796a515e
1 changed files with 5 additions and 3 deletions
|
@ -107,12 +107,14 @@ public:
|
||||||
friend inline constexpr auto operator<=>(
|
friend inline constexpr auto operator<=>(
|
||||||
CreditsAmount a,
|
CreditsAmount a,
|
||||||
CreditsAmount b) {
|
CreditsAmount b) {
|
||||||
if (const auto r1 = (int(a._ton) <=> int(b._ton)); r1 != 0) {
|
if (const auto r1 = (a._whole <=> b._whole); r1 != 0) {
|
||||||
return r1;
|
return r1;
|
||||||
} else if (auto r2 = (a._whole <=> b._whole); r2 != 0) {
|
} else if (const auto r2 = (a._nano <=> b._nano); r2 != 0) {
|
||||||
return r2;
|
return r2;
|
||||||
}
|
}
|
||||||
return (a._nano <=> b._nano);
|
return (a._whole || a._nano)
|
||||||
|
? (int(a._ton) <=> int(b._ton))
|
||||||
|
: std::strong_ordering::equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend inline bool operator==(CreditsAmount, CreditsAmount)
|
friend inline bool operator==(CreditsAmount, CreditsAmount)
|
||||||
|
|
Loading…
Add table
Reference in a new issue