diff options
| author | 2022-10-18 13:01:36 -0400 | |
|---|---|---|
| committer | 2022-10-18 16:06:50 -0400 | |
| commit | 9393f90ccfd3131a021a1c5f3e42f20a287a6560 (patch) | |
| tree | aee5cd108717245e364e91d988181727ee6fd988 | |
| parent | fixed_point: Use variable templates and concepts where applicable (diff) | |
| download | yuzu-9393f90ccfd3131a021a1c5f3e42f20a287a6560.tar.gz yuzu-9393f90ccfd3131a021a1c5f3e42f20a287a6560.tar.xz yuzu-9393f90ccfd3131a021a1c5f3e42f20a287a6560.zip | |
fixed_point: Use defaulted comparisons
Collapses all of the comparison functions down to a single line.
| -rw-r--r-- | src/common/fixed_point.h | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h index b2e489841..7f00dd7b5 100644 --- a/src/common/fixed_point.h +++ b/src/common/fixed_point.h | |||
| @@ -301,29 +301,7 @@ public: | |||
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | public: // comparison operators | 303 | public: // comparison operators |
| 304 | constexpr bool operator==(FixedPoint rhs) const { | 304 | friend constexpr auto operator<=>(FixedPoint lhs, FixedPoint rhs) = default; |
| 305 | return data_ == rhs.data_; | ||
| 306 | } | ||
| 307 | |||
| 308 | constexpr bool operator!=(FixedPoint rhs) const { | ||
| 309 | return data_ != rhs.data_; | ||
| 310 | } | ||
| 311 | |||
| 312 | constexpr bool operator<(FixedPoint rhs) const { | ||
| 313 | return data_ < rhs.data_; | ||
| 314 | } | ||
| 315 | |||
| 316 | constexpr bool operator>(FixedPoint rhs) const { | ||
| 317 | return data_ > rhs.data_; | ||
| 318 | } | ||
| 319 | |||
| 320 | constexpr bool operator<=(FixedPoint rhs) const { | ||
| 321 | return data_ <= rhs.data_; | ||
| 322 | } | ||
| 323 | |||
| 324 | constexpr bool operator>=(FixedPoint rhs) const { | ||
| 325 | return data_ >= rhs.data_; | ||
| 326 | } | ||
| 327 | 305 | ||
| 328 | public: // unary operators | 306 | public: // unary operators |
| 329 | constexpr bool operator!() const { | 307 | constexpr bool operator!() const { |