123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #ifndef BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP
- #define BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP
- #include <boost/compute/function.hpp>
- namespace boost {
- namespace compute {
- namespace detail {
- template<class T>
- class nvidia_popcount : public function<T(T)>
- {
- public:
- nvidia_popcount()
- : function<T(T)>("nvidia_popcount")
- {
- this->set_source(
- "inline uint nvidia_popcount(const uint x)\n"
- "{\n"
- " uint count;\n"
- " asm(\"popc.b32 %0, %1;\" : \"=r\"(count) : \"r\"(x));\n"
- " return count;\n"
- "}\n"
- );
- }
- };
- }
- }
- }
- #endif
|