Re: [RFC] enhanced version of net_random()

From: Andi Kleen
Date: Sun Aug 22 2004 - 10:09:30 EST


On Fri, 20 Aug 2004 12:48:23 -0700
"David S. Miller" <davem@xxxxxxxxxx> wrote:

> > I wouldn't suggest converting it to 'C' because the rotation
> > takes many CPU instructions when one tries to do the test, shift,
> > and OR in 'C',
>
> You only need 2 'shifts' and an 'or' to do a rotate in C.
> No tests are needed.

gcc is clever enough to detect the common C patterns for rotate
and generate a real ROL when the CPU supports it.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/