File indexing completed on 2025-01-18 09:30:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_FUNCTIONAL_ATOMIC_HPP
0012 #define BOOST_COMPUTE_FUNCTIONAL_ATOMIC_HPP
0013
0014 #include <boost/compute/cl.hpp>
0015 #include <boost/compute/function.hpp>
0016
0017 #ifndef BOOST_COMPUTE_DOXYGEN_INVOKED
0018 #ifdef BOOST_COMPUTE_CL_VERSION_1_1
0019 #define BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "atomic_"
0020 #else
0021 #define BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "atom_"
0022 #endif
0023 #endif
0024
0025 namespace boost {
0026 namespace compute {
0027
0028 template<class T>
0029 class atomic_add : public function<T (T*, T)>
0030 {
0031 public:
0032 atomic_add()
0033 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "add")
0034 {
0035 }
0036 };
0037
0038 template<class T>
0039 class atomic_sub : public function<T (T*, T)>
0040 {
0041 public:
0042 atomic_sub()
0043 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "sub")
0044 {
0045 }
0046 };
0047
0048 template<class T>
0049 class atomic_xchg : public function<T (T*, T)>
0050 {
0051 public:
0052 atomic_xchg()
0053 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "xchg")
0054 {
0055 }
0056 };
0057
0058 template<class T>
0059 class atomic_inc : public function<T (T*)>
0060 {
0061 public:
0062 atomic_inc()
0063 : function<T (T*)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "inc")
0064 {
0065 }
0066 };
0067
0068 template<class T>
0069 class atomic_dec : public function<T (T*)>
0070 {
0071 public:
0072 atomic_dec()
0073 : function<T (T*)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "dec")
0074 {
0075 }
0076 };
0077
0078 template<class T>
0079 class atomic_cmpxchg : public function<T (T*, T, T)>
0080 {
0081 public:
0082 atomic_cmpxchg()
0083 : function<T (T*, T, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "cmpxchg")
0084 {
0085 }
0086 };
0087
0088 template<class T>
0089 class atomic_max : public function<T (T*, T)>
0090 {
0091 public:
0092 atomic_max()
0093 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "max")
0094 {
0095 }
0096 };
0097
0098 template<class T>
0099 class atomic_min : public function<T (T*, T)>
0100 {
0101 public:
0102 atomic_min()
0103 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "min")
0104 {
0105 }
0106 };
0107
0108 template<class T>
0109 class atomic_and : public function<T (T*, T)>
0110 {
0111 public:
0112 atomic_and()
0113 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "and")
0114 {
0115 }
0116 };
0117
0118 template<class T>
0119 class atomic_or : public function<T (T*, T)>
0120 {
0121 public:
0122 atomic_or()
0123 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "or")
0124 {
0125 }
0126 };
0127
0128 template<class T>
0129 class atomic_xor : public function<T (T*, T)>
0130 {
0131 public:
0132 atomic_xor()
0133 : function<T (T*, T)>(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "xor")
0134 {
0135 }
0136 };
0137
0138 }
0139 }
0140
0141 #endif