Procházet zdrojové kódy

fixed_point: Use defaulted comparisons

Collapses all of the comparison functions down to a single line.
Lioncash před 3 roky
rodič
revize
9393f90ccf
1 změnil soubory, kde provedl 1 přidání a 23 odebrání
  1. 1 23
      src/common/fixed_point.h

+ 1 - 23
src/common/fixed_point.h

@@ -301,29 +301,7 @@ public:
     }
     }
 
 
 public: // comparison operators
 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
 public: // unary operators
     constexpr bool operator!() const {
     constexpr bool operator!() const {