5 #ifndef GKO_PUBLIC_CORE_BASE_INTRINSICS_HPP_
6 #define GKO_PUBLIC_CORE_BASE_INTRINSICS_HPP_
11 #include <ginkgo/core/base/types.hpp>
21 GKO_ATTRIBUTES GKO_INLINE
int popcount(
uint32 bitmask)
23 #if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__)
24 return __popc(bitmask);
26 std::bitset<32> bits{bitmask};
35 GKO_ATTRIBUTES GKO_INLINE
int popcount(
uint64 bitmask)
37 #if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__)
38 return __popcll(bitmask);
40 std::bitset<64> bits{bitmask};
49 #endif // GKO_PUBLIC_CORE_BASE_INTRINSICS_HPP_