For the below sample code:
// Note that a, b, c and d can have value of 0 or 1 only
int isAllTrue(int a, int b, int c, int d)
{
return (a && b && c && d);
// THIS ALSO RETURNS CORRECT VALUE
// return (a & b & c & d);
}
If we know that operands can be either 0 or 1, which operation would be preferable from performance point of view: bitwise or logical? Does it really matter?
Does evaluation stop in the case of bitwise "&" when the operand is 0 ?