I've come across this piece of code in some forum:
if ( a * b * c * d == 0 ) ....
and the owner claims this is a tad faster than
if (a == 0 || b == 0 || c == 0 || d == 0)
These variables are defined as:
int a, b, c, d;
And their absolute values are guaranteed to be less than or equal to 100. (So we could ignore the possibility of overflowing)
If we just ignore the readability and just focus on the performance, is the claim really correct?
It seems to me that the second approach might actually be faster since you could take advantage of 'short-circuit' sometimes. But then, what-do-I-know?!