Restore experimental optimized operators &= |= ^= for se_t

They were removed approximately 3 years ago due to their rarity.
This commit is contained in:
Nekotekina 2019-09-28 19:34:28 +03:00
parent 7aed9c3f13
commit 0f567abdd8

View file

@ -252,6 +252,12 @@ namespace stx
template <typename T1>
se_t& operator&=(const T1& rhs)
{
if constexpr (std::is_integral_v<T>)
{
m_data = std::bit_cast<stype, T>(static_cast<T>(std::bit_cast<T>(m_data) & std::bit_cast<T>(static_cast<se_t>(rhs))));
return *this;
}
*this = value() & rhs;
return *this;
}
@ -259,6 +265,12 @@ namespace stx
template <typename T1>
se_t& operator|=(const T1& rhs)
{
if constexpr (std::is_integral_v<T>)
{
m_data = std::bit_cast<stype, T>(static_cast<T>(std::bit_cast<T>(m_data) | std::bit_cast<T>(static_cast<se_t>(rhs))));
return *this;
}
*this = value() | rhs;
return *this;
}
@ -266,6 +278,12 @@ namespace stx
template <typename T1>
se_t& operator^=(const T1& rhs)
{
if constexpr (std::is_integral_v<T>)
{
m_data = std::bit_cast<stype, T>(static_cast<T>(std::bit_cast<T>(m_data) ^ std::bit_cast<T>(static_cast<se_t>(rhs))));
return *this;
}
*this = value() ^ rhs;
return *this;
}