Re: [PATCH 2/2] enic: Silence Sparse Warning: "dubious: x | !y"

From: David Miller
Date: Fri Feb 24 2012 - 17:50:14 EST


From: santosh nayak <santoshprasadnayak@xxxxxxxxx>
Date: Fri, 24 Feb 2012 22:27:34 +0530

> From: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>
>
> Sparse is giving the following warning:
> "warning: dubious: x | !y"
>
> "enic_are_pp_different" is static and expected to return true or false.
> Logical or is indended here. With logical or, in best case, execution will be
> faster because if leftmost operand is true then no need to check other operands.
>
> Signed-off-by: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>

As others have explained, this code is intentional. It's faster because
the resulting code has less branches and therefore less potential
branch mispredictions.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/