The Hamming weight of a positive integer is the count of one bits in its binary representation.
The Hamming weight of a positive integer is the count of one bits in its binary representation.
A common synonym is "population count", hence the common function name popcount
.