From: Frederik Deweerdt <deweerdt@free.fr>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] another cleanup TO DO: is_power_of_2() check
Date: Mon, 08 Jan 2007 23:09:26 +0000 [thread overview]
Message-ID: <20070108230925.GF15292@slug> (raw)
In-Reply-To: <Pine.LNX.4.64.0701081732070.25196@localhost.localdomain>
On Mon, Jan 08, 2007 at 05:37:16PM -0500, Robert P. J. Day wrote:
>
> there are *numerous* places in the code that check if some value is
> a power of 2 using the basic test "((x & (x - 1)) = 0)":
>
> $ grep -Er "(.*) ?\& ?\(\1 ?- ?1\)" .
>
> as you can see, that test is all over the place.
>
> occasionally, someone decides to do the right thing and define a
> macro:
>
> $ grep -r "#define is_power_of_2" .
Some of which really are is_power_of_2_but_not_0 :). That corner case
set aside, but it is handled differently throughout the source, it seems
fine to me.
Regards,
Frederik
>
> i'm thinking it might be cleaner to define that macro in kernel.h and
> clean up the source to use that macro, rather than constantly
> rewriting that expression.
>
> thoughts?
>
> rday
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/kernel-janitors
>
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2007-01-08 23:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-08 22:37 [KJ] another cleanup TO DO: is_power_of_2() check Robert P. J. Day
2007-01-08 23:09 ` Frederik Deweerdt [this message]
2007-01-08 23:15 ` Robert P. J. Day
2007-01-09 0:06 ` Frederik Deweerdt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070108230925.GF15292@slug \
--to=deweerdt@free.fr \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.