Re: xor as a lazy comparison

From: Bernd Petrovitsch
Date: Tue Jul 26 2005 - 03:40:39 EST

On Tue, 2005-07-26 at 08:07 +0200, Jan Engelhardt wrote:
> To answer for x *= 2 vs x <<= 1:
and x += x

> Use * when you would logically want to do a multiplication,
> << if you're working on a bitfield. It's just for keeping the code clean
> enough so that others may understand it.
> In the longshot, it does not matter, as gcc will optimize out multiplication
^^^ the C compiler
> with powers of two to bitops.

And if the C compiler is not doing this properly, such tunings are
probably in 100%-\eps cases worthless anyway.

Firmix Software GmbH
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at