Thread (4 messages) 4 messages, 4 authors, 2012-02-24

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

From: David Miller <davem@davemloft.net>
Date: 2012-02-24 22:50:13
Also in: kernel-janitors, lkml

From: santosh nayak <redacted>
Date: Fri, 24 Feb 2012 22:27:34 +0530
From: Santosh Nayak <redacted>

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 <redacted>
As others have explained, this code is intentional.  It's faster because
the resulting code has less branches and therefore less potential
branch mispredictions.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help