Skip to content

popCount32

popCount32(value): number

Defined in: packages/core/src/number/bit/pop-count32.ts:10

Counts the set bits in the low 32 bits of value (Hamming weight).

SWAR (SIMD-within-a-register): sums adjacent bit-pairs, then nibbles, then bytes, then all four bytes in one multiply — no loop, no lookup table.

number

The value to count; only its low 32 bits are considered.

number

The number of set bits, from 0 to 32.