diff options
Diffstat (limited to 'boost/atomic/detail/ops_extending_cas_based.hpp')
-rw-r--r-- | boost/atomic/detail/ops_extending_cas_based.hpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/boost/atomic/detail/ops_extending_cas_based.hpp b/boost/atomic/detail/ops_extending_cas_based.hpp index d7f3c5f5de..3f21031f12 100644 --- a/boost/atomic/detail/ops_extending_cas_based.hpp +++ b/boost/atomic/detail/ops_extending_cas_based.hpp @@ -14,6 +14,7 @@ #ifndef BOOST_ATOMIC_DETAIL_OPS_EXTENDING_CAS_BASED_HPP_INCLUDED_ #define BOOST_ATOMIC_DETAIL_OPS_EXTENDING_CAS_BASED_HPP_INCLUDED_ +#include <cstddef> #include <boost/memory_order.hpp> #include <boost/atomic/detail/config.hpp> #include <boost/atomic/detail/storage_type.hpp> @@ -26,7 +27,7 @@ namespace boost { namespace atomics { namespace detail { -template< typename Base, unsigned int Size, bool Signed > +template< typename Base, std::size_t Size, bool Signed > struct extending_cas_based_operations : public Base { @@ -35,7 +36,8 @@ struct extending_cas_based_operations : static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); emulated_storage_type new_val; do { @@ -47,7 +49,8 @@ struct extending_cas_based_operations : static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); emulated_storage_type new_val; do { |