> diff -Nur --exclude-from=/home/mcd/.dontdiff linux-2.5.69-add_linux_topo/include/linux/bitops.h linux-2.5.69-node_online_fix/include/linux/bitops.h
> --- linux-2.5.69-add_linux_topo/include/linux/bitops.h Sun May 4 16:53:42 2003
> +++ linux-2.5.69-node_online_fix/include/linux/bitops.h Mon May 5 18:00:00 2003
> @@ -107,6 +107,33 @@
> return (res & 0x0F) + ((res >> 4) & 0x0F);
> }
>
> +#if (BITS_PER_LONG == 64)
> +
> +static inline unsigned int generic_hweight64(unsigned int w)
> +{
> + unsigned int res = (w & 0x5555555555555555) + ((w >> 1) & 0x5555555555555555);
Ignoring the fact that the types are wrong for 64 bit values, you can save
one masking (in all generic_hweight functions in fact) by using the
following expression for the first line:
uxx res = w - ((w>>1) & 0x55...55);
where xx is 8, 16, 32, or 64 and the right number of 5s.
That's an old trick but I can't remember the reference nor
where I found the reference to it, sorry.
Gabriel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/