diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:12:59 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:12:59 +0900 |
commit | b8cf34c691623e4ec329053cbbf68522a855882d (patch) | |
tree | 34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/atomic/detail/ops_msvc_arm.hpp | |
parent | 3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff) | |
download | boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.gz boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.bz2 boost-b8cf34c691623e4ec329053cbbf68522a855882d.zip |
Imported Upstream version 1.67.0upstream/1.67.0
Diffstat (limited to 'boost/atomic/detail/ops_msvc_arm.hpp')
-rw-r--r-- | boost/atomic/detail/ops_msvc_arm.hpp | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/boost/atomic/detail/ops_msvc_arm.hpp b/boost/atomic/detail/ops_msvc_arm.hpp index a0cfe81afc..608c6fddf8 100644 --- a/boost/atomic/detail/ops_msvc_arm.hpp +++ b/boost/atomic/detail/ops_msvc_arm.hpp @@ -54,6 +54,7 @@ namespace detail { struct msvc_arm_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool full_cas_based = false; static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT @@ -65,7 +66,7 @@ struct msvc_arm_operations_base { BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); - if ((order & memory_order_release) != 0) + if ((static_cast< unsigned int >(order) & static_cast< unsigned int >(memory_order_release)) != 0u) hardware_full_fence(); BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); @@ -85,7 +86,7 @@ struct msvc_arm_operations_base { BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); - if ((order & (memory_order_consume | memory_order_acquire)) != 0) + if ((static_cast< unsigned int >(order) & (static_cast< unsigned int >(memory_order_consume) | static_cast< unsigned int >(memory_order_acquire))) != 0u) hardware_full_fence(); BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); @@ -94,15 +95,20 @@ struct msvc_arm_operations_base static BOOST_FORCEINLINE BOOST_CONSTEXPR memory_order cas_common_order(memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT { // Combine order flags together and promote memory_order_consume to memory_order_acquire - return static_cast< memory_order >(((failure_order | success_order) & ~memory_order_consume) | (((failure_order | success_order) & memory_order_consume) << 1u)); + return static_cast< memory_order >(((static_cast< unsigned int >(failure_order) | static_cast< unsigned int >(success_order)) & ~static_cast< unsigned int >(memory_order_consume)) + | (((static_cast< unsigned int >(failure_order) | static_cast< unsigned int >(success_order)) & static_cast< unsigned int >(memory_order_consume)) << 1u)); } }; -template< typename T, typename Derived > +template< std::size_t Size, bool Signed, typename Derived > struct msvc_arm_operations : public msvc_arm_operations_base { - typedef T storage_type; + typedef typename make_storage_type< Size >::type storage_type; + typedef typename make_storage_type< Size >::aligned aligned_storage_type; + + static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = Size; + static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed; static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -129,14 +135,10 @@ struct msvc_arm_operations : template< bool Signed > struct operations< 1u, Signed > : - public msvc_arm_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > + public msvc_arm_operations< 1u, Signed, operations< 1u, Signed > > { - typedef msvc_arm_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type; + typedef msvc_arm_operations< 1u, Signed, operations< 1u, Signed > > base_type; typedef typename base_type::storage_type storage_type; - typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type; - - static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 1u; - static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -298,14 +300,10 @@ struct operations< 1u, Signed > : template< bool Signed > struct operations< 2u, Signed > : - public msvc_arm_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > + public msvc_arm_operations< 2u, Signed, operations< 2u, Signed > > { - typedef msvc_arm_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type; + typedef msvc_arm_operations< 2u, Signed, operations< 2u, Signed > > base_type; typedef typename base_type::storage_type storage_type; - typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; - - static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 2u; - static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -467,14 +465,10 @@ struct operations< 2u, Signed > : template< bool Signed > struct operations< 4u, Signed > : - public msvc_arm_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > + public msvc_arm_operations< 4u, Signed, operations< 4u, Signed > > { - typedef msvc_arm_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type; + typedef msvc_arm_operations< 4u, Signed, operations< 4u, Signed > > base_type; typedef typename base_type::storage_type storage_type; - typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; - - static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 4u; - static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -636,14 +630,10 @@ struct operations< 4u, Signed > : template< bool Signed > struct operations< 8u, Signed > : - public msvc_arm_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > + public msvc_arm_operations< 8u, Signed, operations< 8u, Signed > > { - typedef msvc_arm_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > base_type; + typedef msvc_arm_operations< 8u, Signed, operations< 8u, Signed > > base_type; typedef typename base_type::storage_type storage_type; - typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; - - static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u; - static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { |