]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/include/boost/compute/functional/atomic.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / functional / atomic.hpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #ifndef BOOST_COMPUTE_FUNCTIONAL_ATOMIC_HPP
12 #define BOOST_COMPUTE_FUNCTIONAL_ATOMIC_HPP
13
14 #include <boost/compute/cl.hpp>
15 #include <boost/compute/function.hpp>
16
17 #ifndef BOOST_COMPUTE_DOXYGEN_INVOKED
18 #ifdef CL_VERSION_1_1
19 #define BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "atomic_"
20 #else
21 #define BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "atom_"
22 #endif
23 #endif // BOOST_COMPUTE_DOXYGEN_INVOKED
24
25 namespace boost {
26 namespace compute {
27
28 template<class T>
29 class atomic_add : public function<T (T*, T)>
30 {
31 public:
32 atomic_add()
33 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "add")
34 {
35 }
36 };
37
38 template<class T>
39 class atomic_sub : public function<T (T*, T)>
40 {
41 public:
42 atomic_sub()
43 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "sub")
44 {
45 }
46 };
47
48 template<class T>
49 class atomic_xchg : public function<T (T*, T)>
50 {
51 public:
52 atomic_xchg()
53 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "xchg")
54 {
55 }
56 };
57
58 template<class T>
59 class atomic_inc : public function<T (T*)>
60 {
61 public:
62 atomic_inc()
63 : function<T (T*)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "inc")
64 {
65 }
66 };
67
68 template<class T>
69 class atomic_dec : public function<T (T*)>
70 {
71 public:
72 atomic_dec()
73 : function<T (T*)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "dec")
74 {
75 }
76 };
77
78 template<class T>
79 class atomic_cmpxchg : public function<T (T*, T, T)>
80 {
81 public:
82 atomic_cmpxchg()
83 : function<T (T*, T, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "cmpxchg")
84 {
85 }
86 };
87
88 template<class T>
89 class atomic_max : public function<T (T*, T)>
90 {
91 public:
92 atomic_max()
93 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "max")
94 {
95 }
96 };
97
98 template<class T>
99 class atomic_min : public function<T (T*, T)>
100 {
101 public:
102 atomic_min()
103 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "min")
104 {
105 }
106 };
107
108 template<class T>
109 class atomic_and : public function<T (T*, T)>
110 {
111 public:
112 atomic_and()
113 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "and")
114 {
115 }
116 };
117
118 template<class T>
119 class atomic_or : public function<T (T*, T)>
120 {
121 public:
122 atomic_or()
123 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "or")
124 {
125 }
126 };
127
128 template<class T>
129 class atomic_xor : public function<T (T*, T)>
130 {
131 public:
132 atomic_xor()
133 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "xor")
134 {
135 }
136 };
137
138 } // end compute namespace
139 } // end boost namespace
140
141 #endif // BOOST_COMPUTE_FUNCTIONAL_ATOMIC_HPP