From: "Milind Arun Choudhary" <milindchoudhary@gmail.com>
To: Richard Knutsson <ricknu-0@student.ltu.se>,
Alexey Dobriyan <adobriyan@gmail.com>
Cc: kernel-janitors@lists.osdl.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, dmitry.torokhov@gmail.com,
linux-input@atrey.karlin.mff.cuni.cz,
linux-joystick@atrey.karlin.mff.cuni.cz
Subject: Re: [KJ][PATCH] BIT macro cleanup
Date: Fri, 30 Mar 2007 18:01:03 +0530 [thread overview]
Message-ID: <3b44d3fb0703300531l6293e792y94d4f16e43652fb5@mail.gmail.com> (raw)
In-Reply-To: <460B3244.9060405@student.ltu.se>
On 3/29/07, Richard Knutsson <ricknu-0@student.ltu.se> wrote:
> Alexey Dobriyan wrote:
> > On Wed, Mar 28, 2007 at 09:03:09AM +0530, Milind Arun Choudhary wrote:
> >
> >> +#define BIT(nr) (1UL << ((nr) % BITS_PER_LONG))
> >>
> >
> > I think this would be a disaster because something like
> >
> > BIT(123)
> >
> > would not even generate a warning.
> >
> There were a discussion on this, at KJ, when BIT was first used with a
> modular operation. I said the same thing as you do now, but a big user
> of BIT is the input-subsystem who defined their BIT as above. Also it
> was mentioned that the compiler can only find the statical errors, a
> variable input can break it in runtime.
> + if we _really_ want to check the tree for such warnings, it is easy to
> remove the modular operation temporarily (and keep away of input/)
>
> I don't say I like this, just that it is a choose between possible errors.
as discussed in earlier thread there are two kinds of users of BIT
1. input sybsystem which needs the "% BITS_PER_LONG"
2. & all other who don't, so that they are warned when the bit no overflows
I think a simple macro cant serve both the purposes
so IMHO there should be two macros
+#define BIT(nr) (1UL << (nr))
which server the first case
&
+#define XXXBITXXX(nr) (1UL << ((nr) % BITS_PER_LONG))
for input users
earlier i suggested a name BITWRAP
but some people hate it i think
'm fine with any other name as well
inputs....suggest a name
so that we can still keep these two macros (along with LLBIT) in
bitops.h & use apporpriately
only hassle is the whole input tree is to be searched & replaced for BIT
is this OK
--
Milind Arun Choudhary
parent reply other threads:[~2007-03-30 12:31 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <460B3244.9060405@student.ltu.se>]
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=3b44d3fb0703300531l6293e792y94d4f16e43652fb5@mail.gmail.com \
--to=milindchoudhary@gmail.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=kernel-janitors@lists.osdl.org \
--cc=linux-input@atrey.karlin.mff.cuni.cz \
--cc=linux-joystick@atrey.karlin.mff.cuni.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=ricknu-0@student.ltu.se \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).