Re: xor as a lazy comparison

Bernd Petrovitsch
2005-07-26T08:35:05Z

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.

Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services