mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
fixed_point: Use defaulted comparisons
Collapses all of the comparison functions down to a single line.
This commit is contained in:
parent
5000d814af
commit
9393f90ccf
1 changed files with 1 additions and 23 deletions
|
@ -301,29 +301,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
public: // comparison operators
|
public: // comparison operators
|
||||||
constexpr bool operator==(FixedPoint rhs) const {
|
friend constexpr auto operator<=>(FixedPoint lhs, FixedPoint rhs) = default;
|
||||||
return data_ == rhs.data_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool operator!=(FixedPoint rhs) const {
|
|
||||||
return data_ != rhs.data_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool operator<(FixedPoint rhs) const {
|
|
||||||
return data_ < rhs.data_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool operator>(FixedPoint rhs) const {
|
|
||||||
return data_ > rhs.data_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool operator<=(FixedPoint rhs) const {
|
|
||||||
return data_ <= rhs.data_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool operator>=(FixedPoint rhs) const {
|
|
||||||
return data_ >= rhs.data_;
|
|
||||||
}
|
|
||||||
|
|
||||||
public: // unary operators
|
public: // unary operators
|
||||||
constexpr bool operator!() const {
|
constexpr bool operator!() const {
|
||||||
|
|
Loading…
Reference in a new issue