mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Restore experimental optimized operators == != for se_t<>
This commit is contained in:
parent
21885264f7
commit
046f8510fa
@ -194,6 +194,26 @@ namespace stx
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T2>
|
||||
bool operator==(const T2& rhs) const noexcept
|
||||
{
|
||||
using R = simple_t<T2>;
|
||||
|
||||
if constexpr ((std::is_integral_v<T> || std::is_enum_v<T>) && (std::is_integral_v<R> || std::is_enum_v<R>) && sizeof(T) >= sizeof(R))
|
||||
{
|
||||
return std::bit_cast<type>(m_data) == std::bit_cast<type>(static_cast<se_t>(rhs));
|
||||
}
|
||||
|
||||
// Keep outside of if constexpr to make sure it fails on invalid comparison
|
||||
return value() == rhs;
|
||||
}
|
||||
|
||||
template <typename T2>
|
||||
bool operator!=(const T2& rhs) const noexcept
|
||||
{
|
||||
return !operator==<T2>(rhs);
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
se_t& operator+=(const T1& rhs)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user