2
0
mirror of https://github.com/boostorg/atomic.git synced 2026-02-01 20:12:09 +00:00

Microoptimization to reduce the number of branches in 128-bit operator==.

This commit is contained in:
Andrey Semashev
2018-02-10 17:19:03 +03:00
parent 8e7ea418ba
commit 35497819a6

View File

@@ -164,7 +164,7 @@ struct BOOST_ATOMIC_DETAIL_MAY_ALIAS storage128_t
BOOST_FORCEINLINE bool operator== (storage128_t const& left, storage128_t const& right) BOOST_NOEXCEPT
{
return left.data[0] == right.data[0] && left.data[1] == right.data[1];
return ((left.data[0] ^ right.data[0]) | (left.data[1] ^ right.data[1])) == 0u;
}
BOOST_FORCEINLINE bool operator!= (storage128_t const& left, storage128_t const& right) BOOST_NOEXCEPT
{