]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/multiprecision/detail/atomic.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / multiprecision / detail / atomic.hpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright 2017 John Maddock
3 // Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 #ifndef BOOST_MT_ATOMIC_DETAIL_HPP
8 #define BOOST_MT_ATOMIC_DETAIL_HPP
9
10 #include <boost/config.hpp>
11
12 #ifdef BOOST_HAS_THREADS
13
14 #ifndef BOOST_NO_CXX11_HDR_ATOMIC
15 # include <atomic>
16 # define BOOST_MATH_ATOMIC_NS std
17 namespace boost {
18 namespace multiprecision {
19 namespace detail {
20 #if ATOMIC_INT_LOCK_FREE == 2
21 typedef std::atomic<int> atomic_counter_type;
22 typedef std::atomic<unsigned> atomic_unsigned_type;
23 typedef int atomic_integer_type;
24 typedef unsigned atomic_unsigned_integer_type;
25 #elif ATOMIC_SHORT_LOCK_FREE == 2
26 typedef std::atomic<short> atomic_counter_type;
27 typedef std::atomic<unsigned short> atomic_unsigned_type;
28 typedef short atomic_integer_type;
29 typedef unsigned short atomic_unsigned_integer_type;
30 #elif ATOMIC_LONG_LOCK_FREE == 2
31 typedef std::atomic<long> atomic_unsigned_integer_type;
32 typedef std::atomic<unsigned long> atomic_unsigned_type;
33 typedef unsigned long atomic_unsigned_integer_type;
34 typedef long atomic_integer_type;
35 #elif ATOMIC_LLONG_LOCK_FREE == 2
36 typedef std::atomic<long long> atomic_unsigned_integer_type;
37 typedef std::atomic<unsigned long long> atomic_unsigned_type;
38 typedef long long atomic_integer_type;
39 typedef unsigned long long atomic_unsigned_integer_type;
40 #else
41
42 #define BOOST_MT_NO_ATOMIC_INT
43
44 #endif
45 }
46 }}
47 #else // BOOST_NO_CXX11_HDR_ATOMIC
48 //
49 // We need Boost.Atomic, but on any platform that supports auto-linking we do
50 // not need to link against a separate library:
51 //
52 #define BOOST_ATOMIC_NO_LIB
53 #include <boost/atomic.hpp>
54 # define BOOST_MATH_ATOMIC_NS boost
55
56 namespace boost{ namespace multiprecision{ namespace detail{
57
58 //
59 // We need a type to use as an atomic counter:
60 //
61 #if BOOST_ATOMIC_INT_LOCK_FREE == 2
62 typedef boost::atomic<int> atomic_counter_type;
63 typedef boost::atomic<unsigned> atomic_unsigned_type;
64 typedef int atomic_integer_type;
65 typedef unsigned atomic_unsigned_integer_type;
66 #elif BOOST_ATOMIC_SHORT_LOCK_FREE == 2
67 typedef boost::atomic<short> atomic_counter_type;
68 typedef boost::atomic<unsigned short> atomic_unsigned_type;
69 typedef short atomic_integer_type;
70 typedef unsigned short atomic_unsigned_integer_type;
71 #elif BOOST_ATOMIC_LONG_LOCK_FREE == 2
72 typedef boost::atomic<long> atomic_counter_type;
73 typedef boost::atomic<unsigned long> atomic_unsigned_type;
74 typedef long atomic_integer_type;
75 typedef unsigned long atomic_unsigned_integer_type;
76 #elif BOOST_ATOMIC_LLONG_LOCK_FREE == 2
77 typedef boost::atomic<long long> atomic_counter_type;
78 typedef boost::atomic<unsigned long long> atomic_unsigned_type;
79 typedef long long atomic_integer_type;
80 typedef unsigned long long atomic_unsigned_integer_type;
81 #else
82 # define BOOST_MT_NO_ATOMIC_INT
83 #endif
84
85 }}} // namespaces
86
87 #endif // BOOST_NO_CXX11_HDR_ATOMIC
88
89 #else // BOOST_HAS_THREADS
90
91 #define BOOST_MT_NO_ATOMIC_INT
92
93 #endif // BOOST_HAS_THREADS
94
95 namespace boost { namespace multiprecision { namespace detail {
96
97 #ifdef BOOST_MT_NO_ATOMIC_INT
98 typedef unsigned precision_type;
99 #else
100 typedef atomic_unsigned_type precision_type;
101 #endif
102
103 } } }
104
105 #endif // BOOST_MATH_ATOMIC_DETAIL_HPP