[PATCH evdev] Don't crop long value from EvdevBitIsSet.

Jeremy Huddleston jeremyhu at apple.com
Thu Nov 3 01:42:07 PDT 2011


Yuck.

Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Nov 1, 2011, at 4:52 PM, Peter Hutterer wrote:

> Introduced in xf86-input-evdev-2.6.0-26-g4969389
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Cutting long to int for the return value loses us some values, notably in
> the ABS_MT ranges.
> 
> src/evdev.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index f593df0..6ab1a18 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -190,7 +190,7 @@ static size_t EvdevCountBits(unsigned long *array, size_t nlongs)
> 
> static inline int EvdevBitIsSet(const unsigned long *array, int bit)
> {
> -    return array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS));
> +    return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
> }
> 
> static inline void EvdevSetBit(unsigned long *array, int bit)
> -- 
> 1.7.7
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 





More information about the xorg-devel mailing list