Function bitintr::abm::popcnt
[−]
[src]
pub fn popcnt<T: Int>(x: T) -> T
Counts the bits that are set.
Keywords: Population count, count ones, Hamming weight, Sideways sum.
Intrinsic (when available: ABM / SSE4.2)
POPCNT
: Population Count (supports 16/32/64 bit registers).
Note: Intel considers it part of SSE4.2 but advertises it with its own CPUID flag.
Example
use bitintr::abm::popcnt; assert_eq!(popcnt(0b0101_1010u16), 4);