Bits of Entropy

Hamming Weight: Reinventing Efficient Implementation


In this article we start from a simple and inefficient algorithm that calculates population count a.k.a. Hamming weight, and then iteratively arrive at one of the efficient implementations that's in common use today.