On 22 Nov 2011, at 11:21, Bruce Evans wrote:

> If this optimization were any good, then the compiler would already do
> it.  In fact, gcc-4.2.1 already does it -- the reverse of it -- it rewrites:
> 
>       "if ((i == 0) | (j == 0)) return; test();"
> 
> into:
> 
>       "if (i == 0 || j == 0) return; test();"

In general, I prefer | in cases where execution order does not matter because 
it frees the compiler up to insert branches or not, depending on which is more 
efficient for the target.  

In this case, either | or || is fine, because neither reads any memory or has 
side effects so | and || are equivalent to the compiler, but the use of | tells 
a human reading the code that the order is unimportant.  

David_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to