On Wed, Jun 27, 2018 at 02:24:43PM -0700, Jason Gerecke wrote:
> The check here is logically equivalent to (a != b) but much harder to read.
> Lets change that.
> 
> V728 An excessive check can be simplified. The '(A && !B) || (!A && B)'
> expression is equivalent to the 'bool(A) != bool(B)' expression.

proximity is an int, not a bool. So in theory, it could be some other value
and the != doesn't work that well then. I suggest including stdbool.h and
switching all these to boolean at some point. But until then, *shrug*.

Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> for the series.

Cheers,
   Peter

> 
> Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
> ---
>  src/wcmUSB.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index 8ded958..f3b6df0 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -1419,8 +1419,7 @@ static void usbParseKeyEvent(WacomCommonPtr common,
>                       ds->device_id = TOUCH_DEVICE_ID;
>                       ds->proximity = event->value;
>                       /* time stamp for 2FGT gesture events */
> -                     if ((ds->proximity && !dslast->proximity) ||
> -                         (!ds->proximity && dslast->proximity))
> +                     if (ds->proximity != dslast->proximity)
>                               ds->sample = (int)GetTimeInMillis();
>                       break;
>  
> @@ -1431,8 +1430,7 @@ static void usbParseKeyEvent(WacomCommonPtr common,
>                       ds->device_id = TOUCH_DEVICE_ID;
>                       ds->proximity = event->value;
>                       /* time stamp for 2GT gesture events */
> -                     if ((ds->proximity && !dslast->proximity) ||
> -                         (!ds->proximity && dslast->proximity))
> +                     if (ds->proximity != dslast->proximity)
>                               ds->sample = (int)GetTimeInMillis();
>                       /* Second finger events will be considered in
>                        * combination with the first finger data */
> -- 
> 2.18.0
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to