cvs commit: src/sys/sys systm.h

Joerg Sonnenberger joerg at britannica.bec.de
Wed Feb 14 12:49:38 UTC 2007


On Wed, Feb 14, 2007 at 05:21:23AM +0000, Colin Percival wrote:
>   Log:
>   Optimize bitcount32 by replacing 6 logical operations with 2.  The key
>   observation here is that it doesn't matter what garbage accumulates in
>   bits which we're going to end up masking away anyway, as long as the
>   garbage doesn't overflow into bits which we care about.

Three notes:
- The version I found uses 0x3f in the last mask.
- You might want to use __builtin_popcount for those GCC versions, which
support it.
- I found the table version to be faster on Intel, at least in the hot
case.

Joerg


More information about the cvs-src mailing list