44 template<
typename dtype>
50 for (
int bit = 0; bit < DtypeInfo<dtype>::bits(); ++bit)
52 count +=
static_cast<int>((inValue & (dtype{ 1 } << bit)) >> bit);
65 template<
typename dtype>
73 [](dtype inValue) noexcept ->
int { return bit_count(inValue); });
#define STATIC_ASSERT_UNSIGNED_INTEGER(dtype)
Definition: StaticAsserts.hpp:46
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1365
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4511
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1673
iterator begin() noexcept
Definition: NdArrayCore.hpp:1315
std::iterator_traits< InputIt >::difference_type count(InputIt first, InputIt last, const T &value) noexcept
Definition: StlAlgorithms.hpp:119
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:775
Definition: Cartesian.hpp:40
constexpr int bit_count(dtype inValue) noexcept
Definition: bit_count.hpp:45