Re: [PATCH] fs/buffer.c: change buffer_busy() to use logical-ORexpression

From: Al Viro
Date: Sat Oct 23 2010 - 13:21:14 EST


On Sun, Oct 24, 2010 at 02:06:15AM +0900, Namhyung Kim wrote:
> Convert bitwise-OR operator to logical-OR in favor of short-circuit
> evaluation. The end result would be same.

It'll cost _more_.

Think of it:
v = atomic_read(...)
w = bh->b_state
w &= constant
v |= w
return v
vs.
v = atomic_read()
branch to l if not equal to 0
w = bh->b_state
if w & constant is not 0, branch to l
v = 0
return v
l: v = 1
return v

That short-circuit won't win anything here.
--
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/