Re: * 4 converted to << 2 for networking code

From: Pauline Middelink (middelink@polyware.nl)
Date: Wed Jan 10 2001 - 11:25:05 EST


On Wed, 10 Jan 2001 around 18:25:46 +0100, antirez wrote:
> On Wed, Jan 10, 2001 at 04:11:46PM +0100, Jakob ?stergaard wrote:
> > On most processors <<2 is slower than *4. It's outright stupid to
> > write <<2 when we mean *4 in order to optimize for one out of a
> > gazillion supported architectures - even more so when the compiler
> > for the one CPU where <<2 is faster, will actually generate a shift
> > instead of a multiply as a part of the standard optimization.
>
> Hug, ok, so all the << 2 already in should be changed in *4.
> My point is that it is better to use only << 2 or *4, selecting
> the better form.

Well, better not change things so they look like:

#define MSG_BLA1 (1<<1)
#define MSG_BLA2 (1*4)
#define MSG_BLA3 (1<<3)

as a result... :)

    Met vriendelijke groet,
        Pauline Middelink

-- 
GPG Key fingerprint = 2D5B 87A7 DDA6 0378 5DEA  BD3B 9A50 B416 E2D0 C3C2
For more details look at my website http://www.polyware.nl/~middelink
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 15 2001 - 21:00:27 EST