Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Feb 2007 13:25:41 +0100
From:      Joerg Sonnenberger <joerg@britannica.bec.de>
To:        cvs-src@freebsd.org
Subject:   Re: cvs commit: src/sys/sys systm.h
Message-ID:  <20070214122541.GA193@britannica.bec.de>
In-Reply-To: <200702140521.l1E5LNQr044119@repoman.freebsd.org>
References:  <200702140521.l1E5LNQr044119@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070214122541.GA193>