From 9393f90ccfd3131a021a1c5f3e42f20a287a6560 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 18 Oct 2022 13:01:36 -0400 Subject: fixed_point: Use defaulted comparisons Collapses all of the comparison functions down to a single line. --- src/common/fixed_point.h | 24 +----------------------- 1 file changed, 1 insertion(+), 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 { -- cgit v1.2.3