Count the number of set bits in a value. Ex. popcount(0xF000F000) = 8 Returns 0 if Value is zero.
Declared in <llvm/ADT/bit.h>
template<typename T>
[[nodiscard]]
constexpr
int
popcount(T Value) noexcept;
Number of set bits in Value, or 0 if Value is zero.
The return value should not be discarded.
| Name | Description |
|---|---|
| Value | Unsigned value whose set bits are counted. |