Counting bits set in a 32 bit value

Henri Verbeet hverbeet at
Mon Mar 23 09:53:01 CDT 2015

On 23 March 2015 at 15:47, Bruno Jesus <00cpxxx at> wrote:
> Is there any precedent need for this in wine? Is there an accepted
> solution for it? Internet searching shows different ways like bit
> counting with shift, using cpu instructions or internal compiler
> functions.
We have e.g. count_bits() in dlls/wined3d/util.c, but you'll probably
want to use __builtin_popcount() on gcc.

More information about the wine-devel mailing list