File indexing completed on 2025-01-18 09:42:16
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_MP_DETAIL_ATOMIC_HPP
0008 #define BOOST_MP_DETAIL_ATOMIC_HPP
0009
0010 #include <boost/multiprecision/detail/standalone_config.hpp>
0011
0012 #ifdef BOOST_HAS_THREADS
0013
0014 # include <atomic>
0015 # define BOOST_MATH_ATOMIC_NS std
0016 namespace boost {
0017 namespace multiprecision {
0018 namespace detail {
0019 #if ATOMIC_INT_LOCK_FREE == 2
0020 using atomic_counter_type = std::atomic<int>;
0021 using atomic_unsigned_type = std::atomic<unsigned>;
0022 using atomic_integer_type = int;
0023 using atomic_unsigned_integer_type = unsigned;
0024 #elif ATOMIC_SHORT_LOCK_FREE == 2
0025 using atomic_counter_type = std::atomic<short>;
0026 using atomic_unsigned_type = std::atomic<unsigned short>;
0027 using atomic_integer_type = short;
0028 using atomic_unsigned_integer_type = unsigned short;
0029 #elif ATOMIC_LONG_LOCK_FREE == 2
0030 using atomic_unsigned_integer_type = std::atomic<long>;
0031 using atomic_unsigned_type = std::atomic<unsigned long>;
0032 using atomic_unsigned_integer_type = unsigned long;
0033 using atomic_integer_type = long;
0034 #elif ATOMIC_LLONG_LOCK_FREE == 2
0035 using atomic_unsigned_integer_type = std::atomic<long long>;
0036 using atomic_unsigned_type = std::atomic<unsigned long long>;
0037 using atomic_integer_type = long long;
0038 using atomic_unsigned_integer_type = unsigned long long;
0039 #else
0040
0041 #define BOOST_MT_NO_ATOMIC_INT
0042
0043 #endif
0044 }
0045 }}
0046 #else
0047
0048 #define BOOST_MT_NO_ATOMIC_INT
0049
0050 #endif
0051
0052 namespace boost { namespace multiprecision { namespace detail {
0053
0054 #ifdef BOOST_MT_NO_ATOMIC_INT
0055 using precision_type = unsigned;
0056 #else
0057 using precision_type = atomic_unsigned_type;
0058 #endif
0059
0060 } } }
0061
0062 #endif