Re: [PATCH v2 1/3] lib: find_*_bit reimplementation

From: George Spelvin
Date: Mon Feb 02 2015 - 06:48:11 EST


Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> wrote:
> ... and this be part of _find_next_bit? Can find_next_bit not be simply
> 'return _find_next_bit(addr, size, offset, 1);', and similarly for
> find_next_zero_bit? Btw., passing true and false for the boolean
> parameter may be a little clearer.

Looking at the generated code, it would be better to replace the boolean
parameter with 0ul or ~0ul and XOR with it. The same number of registers,
and saves a conditional branch.

(I was hoping GCC would figure that trick out, but it didn't.)
--
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/