Acked-by: Ping Cheng <[email protected]>

On Thu, Apr 8, 2010 at 4:03 PM, Peter Hutterer <[email protected]> wrote:
> Macros like this are in common use in the kernel, X server, etc. and are
> slightly more readable than the |= and &= ~ expressions.
>
> Signed-off-by: Peter Hutterer <[email protected]>
> ---
>  src/wcmISDV4.c          |   12 ++++++------
>  src/wcmValidateDevice.c |    3 +--
>  src/xf86WacomDefs.h     |    2 ++
>  3 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
> index e6a24d0..b63bc9f 100644
> --- a/src/wcmISDV4.c
> +++ b/src/wcmISDV4.c
> @@ -727,20 +727,20 @@ int isdv4ProbeKeys(LocalDevicePtr local)
>        memset(common->wcmKeys, 0, sizeof(common->wcmKeys));
>
>        /* default to penabled */
> -       common->wcmKeys[LONG(BTN_TOOL_PEN)] |= BIT(BTN_TOOL_PEN);
> -       common->wcmKeys[LONG(BTN_TOOL_RUBBER)] |= BIT(BTN_TOOL_RUBBER);
> +       SETBIT(common->wcmKeys, BTN_TOOL_PEN);
> +       SETBIT(common->wcmKeys, BTN_TOOL_RUBBER);
>
>        /* id < 0x008 are only penabled */
>        if (id > 0x007)
> -               common->wcmKeys[LONG(BTN_TOOL_DOUBLETAP)] |= 
> BIT(BTN_TOOL_DOUBLETAP);
> +               SETBIT(common->wcmKeys, BTN_TOOL_DOUBLETAP);
>        if (id > 0x0a)
> -               common->wcmKeys[LONG(BTN_TOOL_TRIPLETAP)] |= 
> BIT(BTN_TOOL_TRIPLETAP);
> +               SETBIT(common->wcmKeys, BTN_TOOL_TRIPLETAP);
>
>        /* no pen 2FGT */
>        if (id == 0x010)
>        {
> -               common->wcmKeys[LONG(BTN_TOOL_PEN)] &= ~BIT(BTN_TOOL_PEN);
> -               common->wcmKeys[LONG(BTN_TOOL_RUBBER)] &= 
> ~BIT(BTN_TOOL_RUBBER);
> +               CLEARBIT(common->wcmKeys, BTN_TOOL_PEN);
> +               CLEARBIT(common->wcmKeys, BTN_TOOL_RUBBER);
>        }
>
>        /* 0x9a and 0x9f are only detected by communicating
> diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
> index d4fd0b2..c7f7233 100644
> --- a/src/wcmValidateDevice.c
> +++ b/src/wcmValidateDevice.c
> @@ -157,8 +157,7 @@ Bool wcmIsAValidType(LocalDevicePtr local, const char* 
> type)
>                        else if (!strlen(dsource)) /* an user defined type */
>                        {
>                                /* assume it is a valid type */
> -                               common->wcmKeys[LONG(wcmType[j].tool)]
> -                                       |= BIT(wcmType[j].tool);
> +                               SETBIT(common->wcmKeys, wcmType[j].tool);
>                                ret = TRUE;
>                                break;
>                        }
> diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
> index 4691a58..2f9e827 100644
> --- a/src/xf86WacomDefs.h
> +++ b/src/xf86WacomDefs.h
> @@ -56,6 +56,8 @@
>  #define BITS_PER_LONG  (sizeof(long) * 8)
>  #define NBITS(x)       ((((x)-1)/BITS_PER_LONG)+1)
>  #define ISBITSET(x,y)  ((x)[LONG(y)] & BIT(y))
> +#define SETBIT(x,y)    ((x)[LONG(y)] |= BIT(y))
> +#define CLEARBIT(x,y)  ((x)[LONG(y)] &= ~BIT(y))
>  #define OFF(x)         ((x)%BITS_PER_LONG)
>  #define LONG(x)                ((x)/BITS_PER_LONG)
>
> --
> 1.6.6.1
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Linuxwacom-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to