umax: restore "natural" operation order

This commit is contained in:
Nekotekina 2020-02-20 17:13:41 +03:00
parent 3e0e1f668c
commit 4d1f818162

View file

@ -423,7 +423,7 @@ constexpr inline struct umax_helper
template <typename T, typename S = simple_t<T>, typename = std::enable_if_t<std::is_unsigned_v<S>>> template <typename T, typename S = simple_t<T>, typename = std::enable_if_t<std::is_unsigned_v<S>>>
constexpr bool operator==(const T& rhs) const constexpr bool operator==(const T& rhs) const
{ {
return std::numeric_limits<S>::max() == rhs; return rhs == std::numeric_limits<S>::max();
} }
#if __cpp_impl_three_way_comparison >= 201711 && !__INTELLISENSE__ #if __cpp_impl_three_way_comparison >= 201711 && !__INTELLISENSE__
@ -431,7 +431,7 @@ constexpr inline struct umax_helper
template <typename T> template <typename T>
friend constexpr std::enable_if_t<std::is_unsigned_v<simple_t<T>>, bool> operator==(const T& lhs, const umax_helper& rhs) friend constexpr std::enable_if_t<std::is_unsigned_v<simple_t<T>>, bool> operator==(const T& lhs, const umax_helper& rhs)
{ {
return std::numeric_limits<simple_t<T>>::max() == lhs; return lhs == std::numeric_limits<simple_t<T>>::max();
} }
#endif #endif
@ -440,13 +440,13 @@ constexpr inline struct umax_helper
template <typename T, typename S = simple_t<T>, typename = std::enable_if_t<std::is_unsigned_v<S>>> template <typename T, typename S = simple_t<T>, typename = std::enable_if_t<std::is_unsigned_v<S>>>
constexpr bool operator!=(const T& rhs) const constexpr bool operator!=(const T& rhs) const
{ {
return std::numeric_limits<S>::max() != rhs; return rhs != std::numeric_limits<S>::max();
} }
template <typename T> template <typename T>
friend constexpr std::enable_if_t<std::is_unsigned_v<simple_t<T>>, bool> operator!=(const T& lhs, const umax_helper& rhs) friend constexpr std::enable_if_t<std::is_unsigned_v<simple_t<T>>, bool> operator!=(const T& lhs, const umax_helper& rhs)
{ {
return std::numeric_limits<simple_t<T>>::max() != lhs; return lhs != std::numeric_limits<simple_t<T>>::max();
} }
#endif #endif
} umax; } umax;