diff options
| author | Lioncash <mathew1800@gmail.com> | 2022-10-18 13:01:36 -0400 | 
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2022-10-18 16:06:50 -0400 | 
| commit | 9393f90ccfd3131a021a1c5f3e42f20a287a6560 (patch) | |
| tree | aee5cd108717245e364e91d988181727ee6fd988 | |
| parent | 5000d814afeefd7eb7f250888b76d6723790f762 (diff) | |
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:      }  public: // comparison operators -    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_; -    } - -    constexpr bool operator>=(FixedPoint rhs) const { -        return data_ >= rhs.data_; -    } +    friend constexpr auto operator<=>(FixedPoint lhs, FixedPoint rhs) = default;  public: // unary operators      constexpr bool operator!() const {  | 
