Bitweight
Bitweight is a measure in computer science and digital electronics that counts the number of one bits in a binary representation of a value. It is also known as the Hamming weight or population count. For a non-negative integer n, the bitweight equals the count of 1s in its binary form; for example, 13 is 1101 in binary, so its bitweight is 3. For a bitvector or bitstring, the bitweight is the sum of its bits.
The concept is distinct from bit length, which counts the total number of bits regardless of value.
Computing bitweight can be done by simple iteration, or more efficiently with algorithms such as Brian Kernighan’s
Bitweight appears in discussions of hash functions, Bloom filters, and syndrome calculations, where knowing the number
---