E.V.E
v2022.03.00

◆ popcount

eve::popcount = {}
inlineconstexpr

Computes elementwise the number of bits set in the parameter.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::unsigned_value T >
T popcount(T x) noexcept;
}
constexpr callable_popcount_ popcount
Computes elementwise the number of bits set in the parameter.
Definition: popcount.hpp:50
Definition: all_of.hpp:22

Parameters

Return value

The value of number of bits set in the value x is returned.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_it pi = {14, 1, 3, 0};
std::cout << "---- simd" << '\n'
<< "<- pi = " << pi << '\n'
<< "-> popcount(pi) = " << eve::popcount(pi) << '\n';
std::uint32_t xf = 48;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> popcount(xf) = " << eve::popcount(xf) << '\n';
return 0;
}
constexpr callable_pi_ pi
Callable object computing the constant .
Definition: pi.hpp:49
Wrapper for SIMD registers.
Definition: wide.hpp:65