Messages in this thread | | | Subject | Re: xor as a lazy comparison | From | Bernd Petrovitsch <> | Date | Tue, 26 Jul 2005 10:30:49 +0200 |
| |
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
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |