2
0
mirror of https://github.com/boostorg/atomic.git synced 2026-02-02 08:22:08 +00:00

Reworked extra operations definition.

In order to support more flexible definition of the extra operations for
different platforms, define extra_operations as an addon to the existing
operations template. The extra_operations template will be used only by
the non-standard operations added by Boost.Atomic.
This commit is contained in:
Andrey Semashev
2017-07-04 22:15:01 +03:00
parent 6d7c0ec2ee
commit 537656d67d
18 changed files with 249 additions and 64 deletions

View File

@@ -21,6 +21,7 @@
#include <boost/atomic/atomic_flag.hpp>
#include <boost/atomic/detail/atomic_template.hpp>
#include <boost/atomic/detail/operations.hpp>
#include <boost/atomic/detail/extra_operations.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once

View File

@@ -22,6 +22,7 @@
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/bitwise_cast.hpp>
#include <boost/atomic/detail/operations_fwd.hpp>
#include <boost/atomic/detail/extra_operations_fwd.hpp>
#include <boost/atomic/detail/type_traits/is_signed.hpp>
#include <boost/atomic/detail/type_traits/is_integral.hpp>
#include <boost/atomic/detail/type_traits/is_function.hpp>
@@ -231,6 +232,7 @@ public:
protected:
typedef atomics::detail::operations< storage_size_of< value_type >::value, boost::atomics::detail::is_signed< T >::value > operations;
typedef atomics::detail::extra_operations< operations, operations::storage_size, operations::is_signed > extra_operations;
typedef value_type value_arg_type;
public:
@@ -336,90 +338,90 @@ public:
// Boost.Atomic extensions
BOOST_FORCEINLINE value_type fetch_negate(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return static_cast< value_type >(operations::fetch_negate(m_storage.value, order));
return static_cast< value_type >(extra_operations::fetch_negate(m_storage.value, order));
}
BOOST_FORCEINLINE value_type fetch_complement(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return static_cast< value_type >(operations::fetch_complement(m_storage.value, order));
return static_cast< value_type >(extra_operations::fetch_complement(m_storage.value, order));
}
BOOST_FORCEINLINE void opaque_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_add(m_storage.value, static_cast< storage_type >(v), order);
extra_operations::opaque_add(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE void opaque_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_sub(m_storage.value, static_cast< storage_type >(v), order);
extra_operations::opaque_sub(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE void opaque_negate(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_negate(m_storage.value, order);
extra_operations::opaque_negate(m_storage.value, order);
}
BOOST_FORCEINLINE void opaque_and(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_and(m_storage.value, static_cast< storage_type >(v), order);
extra_operations::opaque_and(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE void opaque_or(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_or(m_storage.value, static_cast< storage_type >(v), order);
extra_operations::opaque_or(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE void opaque_xor(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_xor(m_storage.value, static_cast< storage_type >(v), order);
extra_operations::opaque_xor(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE void opaque_complement(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_complement(m_storage.value, order);
extra_operations::opaque_complement(m_storage.value, order);
}
BOOST_FORCEINLINE bool add_and_test(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return operations::add_and_test(m_storage.value, static_cast< storage_type >(v), order);
return extra_operations::add_and_test(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE bool sub_and_test(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return operations::sub_and_test(m_storage.value, static_cast< storage_type >(v), order);
return extra_operations::sub_and_test(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE bool and_and_test(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return operations::and_and_test(m_storage.value, static_cast< storage_type >(v), order);
return extra_operations::and_and_test(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE bool or_and_test(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return operations::or_and_test(m_storage.value, static_cast< storage_type >(v), order);
return extra_operations::or_and_test(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE bool xor_and_test(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return operations::xor_and_test(m_storage.value, static_cast< storage_type >(v), order);
return extra_operations::xor_and_test(m_storage.value, static_cast< storage_type >(v), order);
}
BOOST_FORCEINLINE bool bit_test_and_set(unsigned int bit_number, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
BOOST_ASSERT(bit_number < sizeof(value_type) * 8u);
return operations::bit_test_and_set(m_storage.value, bit_number, order);
return extra_operations::bit_test_and_set(m_storage.value, bit_number, order);
}
BOOST_FORCEINLINE bool bit_test_and_reset(unsigned int bit_number, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
BOOST_ASSERT(bit_number < sizeof(value_type) * 8u);
return operations::bit_test_and_reset(m_storage.value, bit_number, order);
return extra_operations::bit_test_and_reset(m_storage.value, bit_number, order);
}
BOOST_FORCEINLINE bool bit_test_and_complement(unsigned int bit_number, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
BOOST_ASSERT(bit_number < sizeof(value_type) * 8u);
return operations::bit_test_and_complement(m_storage.value, bit_number, order);
return extra_operations::bit_test_and_complement(m_storage.value, bit_number, order);
}
// Operators
@@ -573,6 +575,7 @@ public:
protected:
typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations;
typedef atomics::detail::extra_operations< operations, operations::storage_size, operations::is_signed > extra_operations;
typedef value_type value_arg_type;
public:
@@ -665,22 +668,22 @@ public:
// Boost.Atomic extensions
BOOST_FORCEINLINE void opaque_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_add(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order);
extra_operations::opaque_add(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order);
}
BOOST_FORCEINLINE void opaque_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
operations::opaque_sub(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order);
extra_operations::opaque_sub(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order);
}
BOOST_FORCEINLINE bool add_and_test(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return operations::add_and_test(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order);
return extra_operations::add_and_test(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order);
}
BOOST_FORCEINLINE bool sub_and_test(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
return operations::sub_and_test(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order);
return extra_operations::sub_and_test(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order);
}
// Operators

View File

@@ -6,17 +6,20 @@
* Copyright (c) 2015 Andrey Semashev
*/
/*!
* \file atomic/detail/ext_ops_gcc_x86.hpp
* \file atomic/detail/extra_ops_gcc_x86.hpp
*
* This header contains implementation of the extended atomic operations for x86.
* This header contains implementation of the extra atomic operations for x86.
*/
#ifndef BOOST_ATOMIC_DETAIL_EXT_OPS_GCC_X86_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_EXT_OPS_GCC_X86_HPP_INCLUDED_
#ifndef BOOST_ATOMIC_DETAIL_EXTRA_OPS_GCC_X86_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_EXTRA_OPS_GCC_X86_HPP_INCLUDED_
#include <cstddef>
#include <boost/cstdint.hpp>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
#include <boost/atomic/detail/extra_operations_fwd.hpp>
#include <boost/atomic/capabilities.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
@@ -28,7 +31,7 @@ namespace atomics {
namespace detail {
template< typename Base >
struct gcc_x86_extended_operations_common :
struct gcc_x86_extra_operations_common :
public Base
{
typedef Base base_type;
@@ -107,26 +110,23 @@ struct gcc_x86_extended_operations_common :
}
};
template< std::size_t Size, bool Signed, typename Base >
struct gcc_x86_extended_operations;
template< bool Signed, typename Base >
struct gcc_x86_extended_operations< 1u, Signed, Base > :
public gcc_x86_extended_operations_common< Base >
template< typename Base, bool Signed >
struct extra_operations< Base, 1u, Signed > :
public gcc_x86_extra_operations_common< Base >
{
typedef gcc_x86_extended_operations_common< Base > base_type;
typedef gcc_x86_extra_operations_common< Base > base_type;
typedef typename base_type::storage_type storage_type;
#define BOOST_ATOMIC_DETAIL_CAS_LOOP(op, result)\
storage_type new_val;\
boost::uint32_t new_val;\
__asm__ __volatile__\
(\
".align 16\n\t"\
"1: mov %[res], %[new_val]\n\t"\
op " %[new_val]\n\t"\
"lock; cmpxchgb %[new_val], %[storage]\n\t"\
"1: movzbl %[res], %2\n\t"\
op " %b2\n\t"\
"lock; cmpxchgb %b2, %[storage]\n\t"\
"jne 1b"\
: [res] "+a" (result), [storage] "+m" (storage), [new_val] "=&q" (new_val)\
: [res] "+a" (result), [storage] "+m" (storage), "=&q" (new_val)\
: \
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"\
)
@@ -425,23 +425,23 @@ struct gcc_x86_extended_operations< 1u, Signed, Base > :
}
};
template< bool Signed, typename Base >
struct gcc_x86_extended_operations< 2u, Signed, Base > :
public gcc_x86_extended_operations_common< Base >
template< typename Base, bool Signed >
struct extra_operations< Base, 2u, Signed > :
public gcc_x86_extra_operations_common< Base >
{
typedef gcc_x86_extended_operations_common< Base > base_type;
typedef gcc_x86_extra_operations_common< Base > base_type;
typedef typename base_type::storage_type storage_type;
#define BOOST_ATOMIC_DETAIL_CAS_LOOP(op, result)\
storage_type new_val;\
boost::uint32_t new_val;\
__asm__ __volatile__\
(\
".align 16\n\t"\
"1: mov %[res], %[new_val]\n\t"\
op " %[new_val]\n\t"\
"lock; cmpxchgw %[new_val], %[storage]\n\t"\
"1: movzwl %[res], %2\n\t"\
op " %w2\n\t"\
"lock; cmpxchgw %w2, %[storage]\n\t"\
"jne 1b"\
: [res] "+a" (result), [storage] "+m" (storage), [new_val] "=&q" (new_val)\
: [res] "+a" (result), [storage] "+m" (storage), "=&q" (new_val)\
: \
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"\
)
@@ -740,11 +740,11 @@ struct gcc_x86_extended_operations< 2u, Signed, Base > :
}
};
template< bool Signed, typename Base >
struct gcc_x86_extended_operations< 4u, Signed, Base > :
public gcc_x86_extended_operations_common< Base >
template< typename Base, bool Signed >
struct extra_operations< Base, 4u, Signed > :
public gcc_x86_extra_operations_common< Base >
{
typedef gcc_x86_extended_operations_common< Base > base_type;
typedef gcc_x86_extra_operations_common< Base > base_type;
typedef typename base_type::storage_type storage_type;
#define BOOST_ATOMIC_DETAIL_CAS_LOOP(op, result)\
@@ -1057,11 +1057,11 @@ struct gcc_x86_extended_operations< 4u, Signed, Base > :
#if defined(__x86_64__)
template< bool Signed, typename Base >
struct gcc_x86_extended_operations< 8u, Signed, Base > :
public gcc_x86_extended_operations_common< Base >
template< typename Base, bool Signed >
struct extra_operations< Base, 8u, Signed > :
public gcc_x86_extra_operations_common< Base >
{
typedef gcc_x86_extended_operations_common< Base > base_type;
typedef gcc_x86_extra_operations_common< Base > base_type;
typedef typename base_type::storage_type storage_type;
#define BOOST_ATOMIC_DETAIL_CAS_LOOP(op, result)\
@@ -1378,4 +1378,4 @@ struct gcc_x86_extended_operations< 8u, Signed, Base > :
} // namespace atomics
} // namespace boost
#endif // BOOST_ATOMIC_DETAIL_EXT_OPS_GCC_X86_HPP_INCLUDED_
#endif // BOOST_ATOMIC_DETAIL_EXTRA_OPS_GCC_X86_HPP_INCLUDED_

View File

@@ -6,17 +6,19 @@
* Copyright (c) 2015 Andrey Semashev
*/
/*!
* \file atomic/detail/ext_ops_generic.hpp
* \file atomic/detail/extra_ops_generic.hpp
*
* This header contains generic implementation of the extended atomic operations.
* This header contains generic implementation of the extra atomic operations.
*/
#ifndef BOOST_ATOMIC_DETAIL_EXT_OPS_GENERIC_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_EXT_OPS_GENERIC_HPP_INCLUDED_
#ifndef BOOST_ATOMIC_DETAIL_EXTRA_OPS_GENERIC_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_EXTRA_OPS_GENERIC_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
#include <boost/atomic/detail/extra_operations_fwd.hpp>
#include <boost/atomic/capabilities.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
@@ -27,8 +29,9 @@ namespace boost {
namespace atomics {
namespace detail {
// Default extra_operations template definition will be used unless specialized for a specific platform
template< typename Base, std::size_t Size, bool Signed >
struct generic_extended_operations :
struct extra_operations :
public Base
{
typedef Base base_type;
@@ -139,4 +142,4 @@ struct generic_extended_operations :
} // namespace atomics
} // namespace boost
#endif // BOOST_ATOMIC_DETAIL_EXT_OPS_GENERIC_HPP_INCLUDED_
#endif // BOOST_ATOMIC_DETAIL_EXTRA_OPS_GENERIC_HPP_INCLUDED_

View File

@@ -149,6 +149,9 @@ struct operations :
public emulated_operations< typename make_storage_type< Size, Signed >::type >
{
typedef typename make_storage_type< Size, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = Size;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
} // namespace detail

View File

@@ -16,6 +16,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_ALPHA_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_ALPHA_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
@@ -92,6 +93,9 @@ struct operations< 4u, Signed > :
typedef typename make_storage_type< 4u, Signed >::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
{
fence_before(order);
@@ -599,6 +603,9 @@ struct operations< 8u, Signed > :
typedef typename make_storage_type< 8u, Signed >::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
{
fence_before(order);

View File

@@ -16,6 +16,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_ARM_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_ARM_HPP_INCLUDED_
#include <cstddef>
#include <boost/cstdint.hpp>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
@@ -160,6 +161,9 @@ struct operations< 4u, Signed > :
typedef typename make_storage_type< 4u, Signed >::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
{
fence_before(order);
@@ -677,6 +681,9 @@ struct operations< 8u, Signed > :
typedef typename make_storage_type< 8u, Signed >::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
{
exchange(storage, v, order);

View File

@@ -14,6 +14,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_ATOMIC_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_ATOMIC_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
@@ -172,6 +173,8 @@ template< bool Signed >
struct operations< 16u, Signed > :
public cas_based_operations< gcc_dcas_x86_64< Signed > >
{
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#else
@@ -181,6 +184,9 @@ struct operations< 16u, Signed > :
public gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >
{
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif
@@ -195,6 +201,8 @@ template< bool Signed >
struct operations< 8u, Signed > :
public cas_based_operations< gcc_dcas_x86< Signed > >
{
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#elif (BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 8 && __GCC_ATOMIC_LLONG_LOCK_FREE != BOOST_ATOMIC_LLONG_LOCK_FREE) ||\
@@ -210,6 +218,9 @@ struct operations< 8u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 8u, Signed >
{
typedef typename make_storage_type< 16u, 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;
};
#else
@@ -219,6 +230,9 @@ struct operations< 8u, Signed > :
public gcc_atomic_operations< typename make_storage_type< 8u, Signed >::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;
};
#endif
@@ -240,6 +254,9 @@ struct operations< 4u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 4u, Signed >
{
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;
};
#else // !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
@@ -249,6 +266,9 @@ struct operations< 4u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 4u, Signed >
{
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif // !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
@@ -260,6 +280,9 @@ struct operations< 4u, Signed > :
public gcc_atomic_operations< typename make_storage_type< 4u, Signed >::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;
};
#endif
@@ -281,6 +304,9 @@ struct operations< 2u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 4u, Signed >::type >, 2u, Signed >
{
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;
};
#elif !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
@@ -290,6 +316,9 @@ struct operations< 2u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 2u, Signed >
{
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;
};
#else
@@ -299,6 +328,9 @@ struct operations< 2u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 2u, Signed >
{
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif
@@ -310,6 +342,9 @@ struct operations< 2u, Signed > :
public gcc_atomic_operations< typename make_storage_type< 2u, Signed >::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;
};
#endif
@@ -331,6 +366,9 @@ struct operations< 1u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 2u, Signed >::type >, 1u, Signed >
{
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;
};
#elif !defined(BOOST_ATOMIC_DETAIL_INT32_EXTENDED)
@@ -340,6 +378,9 @@ struct operations< 1u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 4u, Signed >::type >, 1u, Signed >
{
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;
};
#elif !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
@@ -349,6 +390,9 @@ struct operations< 1u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 1u, Signed >
{
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;
};
#else
@@ -358,6 +402,9 @@ struct operations< 1u, Signed > :
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 1u, Signed >
{
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif
@@ -369,6 +416,9 @@ struct operations< 1u, Signed > :
public gcc_atomic_operations< typename make_storage_type< 1u, Signed >::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;
};
#endif

View File

@@ -16,6 +16,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_PPC_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_PPC_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
@@ -115,6 +116,9 @@ struct operations< 4u, Signed > :
typedef typename make_storage_type< 4u, Signed >::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
{
fence_before(order);
@@ -537,6 +541,9 @@ struct operations< 8u, Signed > :
typedef typename make_storage_type< 8u, Signed >::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
{
fence_before(order);

View File

@@ -16,6 +16,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_SPARC_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_SPARC_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
@@ -66,6 +67,9 @@ struct gcc_sparc_cas32 :
typedef typename make_storage_type< 4u, Signed >::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
{
fence_before(order);
@@ -147,6 +151,9 @@ struct gcc_sparc_cas64 :
typedef typename make_storage_type< 8u, Signed >::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
{
fence_before(order);

View File

@@ -16,6 +16,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_SYNC_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_SYNC_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
@@ -164,15 +165,22 @@ struct operations< 1u, Signed > :
{
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1)
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 1u;
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2)
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 2u;
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 4u;
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
#else
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
#endif
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif
@@ -191,13 +199,19 @@ struct operations< 2u, Signed > :
{
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2)
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 2u;
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 4u;
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
#else
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
#endif
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif
@@ -214,11 +228,16 @@ struct operations< 4u, Signed > :
{
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 4u;
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
#else
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
#endif
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif
@@ -233,9 +252,13 @@ struct operations< 8u, Signed > :
{
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
#else
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
#endif
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif
@@ -245,6 +268,9 @@ struct operations< 16u, Signed > :
public gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >
{
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif

View File

@@ -16,6 +16,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_X86_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_X86_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
@@ -114,6 +115,9 @@ struct operations< 1u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
__asm__ __volatile__
@@ -201,6 +205,9 @@ struct operations< 2u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
__asm__ __volatile__
@@ -288,6 +295,9 @@ struct operations< 4u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
__asm__ __volatile__
@@ -373,6 +383,8 @@ template< bool Signed >
struct operations< 8u, Signed > :
public cas_based_operations< gcc_dcas_x86< Signed > >
{
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#elif defined(__x86_64__)
@@ -385,6 +397,9 @@ struct operations< 8u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
__asm__ __volatile__
@@ -472,6 +487,8 @@ template< bool Signed >
struct operations< 16u, Signed > :
public cas_based_operations< gcc_dcas_x86_64< Signed > >
{
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
};
#endif // defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)

View File

@@ -18,6 +18,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_LINUX_ARM_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_LINUX_ARM_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
@@ -91,6 +92,9 @@ struct linux_arm_cas :
typedef typename make_storage_type< 4u, Signed >::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
{
fence_before_store(order);

View File

@@ -17,6 +17,7 @@
#define BOOST_ATOMIC_DETAIL_OPS_MSVC_ARM_HPP_INCLUDED_
#include <intrin.h>
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/interlocked.hpp>
@@ -134,6 +135,9 @@ struct operations< 1u, Signed > :
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
{
base_type::fence_before_store(order);
@@ -300,6 +304,9 @@ struct operations< 2u, Signed > :
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
{
base_type::fence_before_store(order);
@@ -466,6 +473,9 @@ struct operations< 4u, Signed > :
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
{
base_type::fence_before_store(order);
@@ -632,6 +642,9 @@ struct operations< 8u, Signed > :
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
{
base_type::fence_before_store(order);

View File

@@ -16,6 +16,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_MSVC_X86_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_MSVC_X86_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/interlocked.hpp>
@@ -164,6 +165,9 @@ struct operations< 4u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&storage, v));
@@ -236,6 +240,9 @@ struct operations< 1u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8(&storage, v));
@@ -281,6 +288,9 @@ struct operations< 1u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);
@@ -422,6 +432,9 @@ struct operations< 2u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16(&storage, v));
@@ -467,6 +480,9 @@ struct operations< 2u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);
@@ -609,6 +625,9 @@ struct msvc_dcas_x86
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
// Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, 8.1.1. Guaranteed Atomic Operations:
//
// The Pentium processor (and newer processors since) guarantees that the following additional memory operations will always be carried out atomically:
@@ -812,6 +831,9 @@ struct operations< 8u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(&storage, v));
@@ -859,6 +881,9 @@ struct msvc_dcas_x86_64
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
storage_type value = const_cast< storage_type& >(storage);

View File

@@ -23,6 +23,7 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_WINDOWS_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_WINDOWS_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/interlocked.hpp>
@@ -109,6 +110,9 @@ struct operations< 4u, Signed > :
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 storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);

View File

@@ -30,6 +30,7 @@
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_x86
#define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND gcc_x86
#elif defined(__GNUC__) && (defined(__POWERPC__) || defined(__PPC__))
@@ -126,7 +127,12 @@
#define BOOST_ATOMIC_EMULATED
#endif
#define BOOST_ATOMIC_DETAIL_PLATFROM_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_PLATFROM).hpp>
#if !defined(BOOST_ATOMIC_DETAIL_EXTRA_BACKEND)
#define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND generic
#define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND_GENERIC
#endif
#define BOOST_ATOMIC_DETAIL_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_BACKEND).hpp>
#define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_EXTRA_BACKEND).hpp>
#endif // BOOST_ATOMIC_DETAIL_PLATFORM_HPP_INCLUDED_

View File

@@ -224,7 +224,9 @@ struct make_storage_type< 16u, true >
struct BOOST_ATOMIC_DETAIL_MAY_ALIAS storage128_t
{
boost::uint64_t data[2];
typedef boost::uint64_t BOOST_ATOMIC_DETAIL_MAY_ALIAS element_type;
element_type data[2];
BOOST_FORCEINLINE bool operator! () const BOOST_NOEXCEPT
{