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_DETAIL_NVIDIA_POPCOUNT_HPP
0012 #define BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP
0013
0014 #include <boost/compute/function.hpp>
0015
0016 namespace boost {
0017 namespace compute {
0018 namespace detail {
0019
0020 template<class T>
0021 class nvidia_popcount : public function<T(T)>
0022 {
0023 public:
0024 nvidia_popcount()
0025 : function<T(T)>("nvidia_popcount")
0026 {
0027 this->set_source(
0028 "inline uint nvidia_popcount(const uint x)\n"
0029 "{\n"
0030 " uint count;\n"
0031 " asm(\"popc.b32 %0, %1;\" : \"=r\"(count) : \"r\"(x));\n"
0032 " return count;\n"
0033 "}\n"
0034 );
0035 }
0036 };
0037
0038 }
0039 }
0040 }
0041
0042 #endif