Re: [patch 14/44] generic hweight{64,32,16,8}()
Andi Kleen <[email protected]> Wed, 01 Feb 2006 09:06:07 +0000
| Newsgroups | org.kernel.vger.ultralinux,org.kernel.vger.linux-ia64,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mips,org.kernel.vger.sparclinux,org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <[email protected]> |
On Wednesday 01 February 2006 10:02, Akinobu Mita wrote:
> +static inline unsigned int hweight32(unsigned int w)
> +{
> + unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
> + res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
> + res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
> + res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
> + return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
> +}
How large are these functions on x86? Maybe it would be better to not inline them,
but put it into some C file out of line.
-Andi