diff --git a/rpcs3/util/endian.hpp b/rpcs3/util/endian.hpp index c3983ec802..aee04c1e55 100644 --- a/rpcs3/util/endian.hpp +++ b/rpcs3/util/endian.hpp @@ -194,6 +194,26 @@ namespace stx } #endif + template + bool operator==(const T2& rhs) const noexcept + { + using R = simple_t; + + if constexpr ((std::is_integral_v || std::is_enum_v) && (std::is_integral_v || std::is_enum_v) && sizeof(T) >= sizeof(R)) + { + return std::bit_cast(m_data) == std::bit_cast(static_cast(rhs)); + } + + // Keep outside of if constexpr to make sure it fails on invalid comparison + return value() == rhs; + } + + template + bool operator!=(const T2& rhs) const noexcept + { + return !operator==(rhs); + } + template se_t& operator+=(const T1& rhs) {