From 0f567abdd8585e426cf5e712cf2fa8066dc7d820 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sat, 28 Sep 2019 19:34:28 +0300 Subject: [PATCH] Restore experimental optimized operators &= |= ^= for se_t They were removed approximately 3 years ago due to their rarity. --- rpcs3/util/endian.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rpcs3/util/endian.hpp b/rpcs3/util/endian.hpp index aee04c1e55..6cd586e96b 100644 --- a/rpcs3/util/endian.hpp +++ b/rpcs3/util/endian.hpp @@ -252,6 +252,12 @@ namespace stx template se_t& operator&=(const T1& rhs) { + if constexpr (std::is_integral_v) + { + m_data = std::bit_cast(static_cast(std::bit_cast(m_data) & std::bit_cast(static_cast(rhs)))); + return *this; + } + *this = value() & rhs; return *this; } @@ -259,6 +265,12 @@ namespace stx template se_t& operator|=(const T1& rhs) { + if constexpr (std::is_integral_v) + { + m_data = std::bit_cast(static_cast(std::bit_cast(m_data) | std::bit_cast(static_cast(rhs)))); + return *this; + } + *this = value() | rhs; return *this; } @@ -266,6 +278,12 @@ namespace stx template se_t& operator^=(const T1& rhs) { + if constexpr (std::is_integral_v) + { + m_data = std::bit_cast(static_cast(std::bit_cast(m_data) ^ std::bit_cast(static_cast(rhs)))); + return *this; + } + *this = value() ^ rhs; return *this; }