On Tue, Mar 6, 2012 at 1:40 PM, Linus Torvalds
<[email protected]> wrote:
>
> (*) "1 << ffz(a)" can be written as
>
> a = ~a; /* Turn the zero bits into 1 bits */
> a &= -a; /* .. and find the first one. */
>
> without ever doing any insane bit scanning.
Alternatively, wite it directly as "(a+1) &~a", which is the same
expression just written differently (due to "-a == ~a+1")
Yeah, I've been playing too much with the bitwise optimizations of the
dentry cache name comparisons lately.
Linus
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html