> Linus Torvalds wrote:
> > It used to do noticeably better compiler-wise. I don't know if newer
> > versions of gcc have made ^ and != generate the same code.
> Odd.
>
> I would expect != to generate better code than ^: != uses `cmp'
> instruction, ^ uses `xor' unless the compiler gets clever.
Don't "expect", write a proggie and check. E.g. with egcs-19990524, both ifs
in this give the same code:
f(int a, int b, int c, int a2, int b2, int c2)
{
if((a ^ b) && (b ^ c))
do_it1();
if((a2 != b2) && (b2 != c2))
do_it2();
}
-- Horst von Brand vonbrand@sleipnir.valparaiso.cl Casilla 9G, Viņa del Mar, Chile +56 32 672616- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/