Re: [PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"

From: Ohad Ben-Cohen
Date: Mon Dec 07 2015 - 11:17:27 EST


On Mon, Dec 7, 2015 at 5:03 PM, zhaoxiu.zeng <zhaoxiu.zeng@xxxxxxxxx> wrote:
> is_power_of_2 is simple, and faster than "hweightN(x) == 1" on most architectures.

Thanks. I'm not sure that speed is a major concern here, since this
code executes only once during the lifetime of the driver. Readability
is probably more important.
--
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/