netdev
[Top] [All Lists]

Re: [RFC] enhanced version of net_random()

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: Re: [RFC] enhanced version of net_random()
From: Andi Kleen <ak@xxxxxxx>
Date: Sun, 22 Aug 2004 17:04:14 +0200
Cc: root@xxxxxxxxxxxxxxxxxx, adilger@xxxxxxxxxxxxx, jlcooke@xxxxxxxxxxxxxx, shemminger@xxxxxxxx, alan@xxxxxxxxxxxxxxxxxxx, tytso@xxxxxxx, netdev@xxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
In-reply-to: <20040820124823.071ac1d9.davem@redhat.com>
References: <20040812104835.3b179f5a@dell_ss3.pdx.osdl.net> <20040820175952.GI5806@certainkey.com> <20040820185956.GV8967@schnapps.adilger.int> <Pine.LNX.4.53.0408201518250.25319@chaos> <20040820124823.071ac1d9.davem@redhat.com>
Sender: netdev-bounce@xxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>