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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"