simdpp::popcnt

From libsimdpp-docs
< int
template<unsigned N, class E1, class E2>
Ret<N, _DETAIL_> popcnt( Vec<N,E1> a );

Counts the number of set bits (population count) in each element of the vector. The implementation behaves as if the following set of overloads is provided:

Ret Vec
int8 int8
uint8 uint8
int16 int16
uint16 uint16
int32 int32
uint32 uint32
int64 int64
uint64 uint64

The return type is a vector expression.

Parameters[edit]

a - integer vector

Return value[edit]

A vector expression evaluating to popcnt(a).

Equivalent operation[edit]

r0 = popcnt(a0)
...
rN = popcnt(aN)

See also[edit]

computes the sum of set bits in all elements in the vector
(function template)