[PATCH 05/18] Fix 64bit arch issue in synaptics eventcomm.c
Takashi Iwai
tiwai at suse.de
Fri Oct 8 12:36:02 PDT 2010
At Fri, 8 Oct 2010 20:48:10 +0200 (CEST),
Mark Kettenis wrote:
>
> > From: Takashi Iwai <tiwai at suse.de>
> > Date: Fri, 8 Oct 2010 19:22:29 +0200
>
> Sorry, but it isn't obvious to me what issue this fixes.
In C, "1" is an integer, not an unsigned long.
Thus (1 << 33) doesn't give you the 33th bit shift, but it's undefined.
If any, this must be (1UL << 32).
Also, it'd be better if such a test macro returns 1 instead of a
random non-zero value. So does my patch.
(Yeah, I know the changelogs are missing in most of patches;
as mentioned, it's just flushing of initial patches ;)
I'll rewrite and resubmit after reviews.)
Takashi
> > src/eventcomm.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/src/eventcomm.c b/src/eventcomm.c
> > index 1fc41ef..8a77788 100644
> > --- a/src/eventcomm.c
> > +++ b/src/eventcomm.c
> > @@ -49,7 +49,7 @@
> > #define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
> > #define OFF(x) ((x) % LONG_BITS)
> > #define LONG(x) ((x) / LONG_BITS)
> > -#define TEST_BIT(bit, array) (array[LONG(bit)] & (1 << OFF(bit)))
> > +#define TEST_BIT(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
> >
> > #define SYNAPTICS_LED_SYS_FILE "/sys/class/leds/psmouse::synaptics/brightness"
> >
>
More information about the xorg-devel
mailing list