svn commit: r273274 - head/sys/netpfil/ipfw
Andriy Gapon
avg at FreeBSD.org
Sun Oct 19 12:03:13 UTC 2014
On 19/10/2014 14:15, Alexander V. Chernikov wrote:
> +static uint32_t
> +roundup2p(uint32_t v)
> +{
> +
> + v--;
> + v |= v >> 1;
> + v |= v >> 2;
> + v |= v >> 4;
> + v |= v >> 8;
> + v |= v >> 16;
> + v++;
> +
> + return (v);
> +}
I think that on platforms where an optimized version of fls() is available that
would work faster than this cool piece of bit magic.
--
Andriy Gapon
More information about the svn-src-head
mailing list