Luigi Rizzo writes:
> This code is not performance critical. I wouldn't bother optimizing it.
So just use fls() or flsl().
DES
--
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn
On Sun, Oct 19, 2014 at 03:02:07PM +0300, Andriy Gapon wrote:
> 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;
> >
On Tue, 21 Oct 2014, David Chisnall wrote:
On 19 Oct 2014, at 13:02, Andriy Gapon wrote:
I think that on platforms where an optimized version of fls() is available that
would work faster than this cool piece of bit magic.
Even a lightly optimized naive linear search might work faster. The
On 19 Oct 2014, at 13:02, Andriy Gapon wrote:
> I think that on platforms where an optimized version of fls() is available
> that
> would work faster than this cool piece of bit magic.
If you're lucky, the compiler's idiom recogniser will spot this. You're
generally better off using the built
On Sun, 19 Oct 2014, at 13:02, Andriy Gapon wrote:
> I think that on platforms where an optimized version of fls() is
> available that
> would work faster than this cool piece of bit magic.
This is a common enough idiom that perhaps a macro should be added:
sys/param.h:
#define roundup(x, y)
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 a
Author: melifaro
Date: Sun Oct 19 11:15:19 2014
New Revision: 273274
URL: https://svnweb.freebsd.org/changeset/base/273274
Log:
Perform more checks on the number of tables supplied by user.
Modified:
head/sys/netpfil/ipfw/ip_fw_table.c
Modified: head/sys/netpfil/ipfw/ip_fw_table.c
==