Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1285744

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

From Ohad Ben-Cohen <ohad@wizery.com>
Newsgroups linux.kernel
Subject Re: [PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"
Date 2015-12-07 17:20 +0100
Message-ID <qD6G7-6S6-35@gated-at.bofh.it> (permalink)
References <qCETv-5Ko-5@gated-at.bofh.it> <qD1Q5-3GX-7@gated-at.bofh.it> <qD5Ao-6co-53@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Dec 7, 2015 at 5:03 PM, zhaoxiu.zeng <zhaoxiu.zeng@gmail.com> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)" Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com> - 2015-12-06 11:40 +0100
  Re: [PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) !=  1" with "!is_power_of_2(i & 0xf)" Ohad Ben-Cohen <ohad@wizery.com> - 2015-12-07 12:10 +0100
    Re: [PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) !=  1" with "!is_power_of_2(i & 0xf)" "zhaoxiu.zeng" <zhaoxiu.zeng@gmail.com> - 2015-12-07 16:10 +0100
      Re: [PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) !=  1" with "!is_power_of_2(i & 0xf)" Ohad Ben-Cohen <ohad@wizery.com> - 2015-12-07 17:20 +0100

csiph-web