native 0.0.1
Vectors, masks and wide register packs for C++26
Loading...
Searching...
No Matches
POPCNT
Collaboration diagram for POPCNT:

Functions

template<isa< x86 > Arch = NATIVE_BASELINE>
requires (Arch.has(x86_feature::popcnt))
constexpr std::uint16_t native::popcnt (std::uint16_t value) noexcept
template<isa< x86 > Arch = NATIVE_BASELINE>
requires (Arch.has(x86_feature::popcnt))
constexpr std::uint32_t native::popcnt (std::uint32_t value) noexcept
template<isa< x86 > Arch = NATIVE_BASELINE>
requires (Arch.has(x86_feature::popcnt))
constexpr std::uint64_t native::popcnt (std::uint64_t value) noexcept

Detailed Description

Scalar bit counts requiring only CPUID leaf 1 ECX bit 23. Runtime calls require x86_feature::popcnt in the supplied ISA. Admit that feature before entering a matching target scope. No vector OS state is required. Constant evaluation supports every x86 Arch; weak tags select consteval overloads.

Function Documentation

◆ popcnt() [1/3]

template<isa< x86 > Arch = NATIVE_BASELINE>
requires (Arch.has(x86_feature::popcnt))
std::uint16_t native::popcnt ( std::uint16_t value)
inlineconstexprexportnoexcept

Count the set bits of a 16-bit value; zero returns zero. Arch must contain POPCNT; runtime callers must enable and admit that feature.

Definition at line 24 of file popcnt.h.

Here is the caller graph for this function:

◆ popcnt() [2/3]

template<isa< x86 > Arch = NATIVE_BASELINE>
requires (Arch.has(x86_feature::popcnt))
std::uint32_t native::popcnt ( std::uint32_t value)
inlineconstexprexportnoexcept

Count the set bits of a 32-bit value; zero returns zero. Arch must contain POPCNT; runtime callers must enable and admit that feature.

Definition at line 36 of file popcnt.h.

◆ popcnt() [3/3]

template<isa< x86 > Arch = NATIVE_BASELINE>
requires (Arch.has(x86_feature::popcnt))
std::uint64_t native::popcnt ( std::uint64_t value)
inlineconstexprexportnoexcept

Count the set bits of a 64-bit value; zero returns zero. Arch must contain POPCNT; runtime callers must enable and admit that feature.

Definition at line 48 of file popcnt.h.