diff --git a/input/connect/connect_nesusb.c b/input/connect/connect_nesusb.c index fc484ea88d..cc557cee46 100644 --- a/input/connect/connect_nesusb.c +++ b/input/connect/connect_nesusb.c @@ -81,7 +81,9 @@ static int16_t hidpad_nesusb_get_axis(void *data, unsigned axis) val = device->data[4 + axis]; val = (val << 8) - 0x8000; - return (abs(val) > 0x1000) ? val : 0; + if (abs(val) > 0x1000) + return val; + return 0; } static void hidpad_nesusb_packet_handler(void *data, uint8_t *packet, uint16_t size) diff --git a/input/connect/connect_ps2adapter.c b/input/connect/connect_ps2adapter.c index 4ee0e5e6cb..6a324b9491 100644 --- a/input/connect/connect_ps2adapter.c +++ b/input/connect/connect_ps2adapter.c @@ -98,7 +98,9 @@ static int16_t hidpad_ps2adapter_get_axis(void *data, unsigned axis) val = (val << 8) - 0x8000; - return (abs(val) > 0x1000) ? val : 0; + if (abs(val) > 0x1000) + return val; + return 0; } #define PS2_H_GET(a) (a & 0x0F) /*HAT MASK = 0x0F */ diff --git a/input/connect/connect_ps3.c b/input/connect/connect_ps3.c index 1cc955b655..bd80e78653 100644 --- a/input/connect/connect_ps3.c +++ b/input/connect/connect_ps3.c @@ -154,7 +154,9 @@ static int16_t hidpad_ps3_get_axis(void *data, unsigned axis) val = device->data[7 + axis]; val = (val << 8) - 0x8000; - return (abs(val) > 0x1000) ? val : 0; + if (abs(val) > 0x1000) + return val; + return 0; } static void hidpad_ps3_packet_handler(void *data, diff --git a/input/connect/connect_psxadapter.c b/input/connect/connect_psxadapter.c index cbc6a402f9..bae62bea96 100644 --- a/input/connect/connect_psxadapter.c +++ b/input/connect/connect_psxadapter.c @@ -99,7 +99,10 @@ static int16_t hidpad_psxadapter_get_axis(void *data, unsigned axis) val = (val << 8) - 0x8000; - return (abs(val) > 0x1000) ? val : 0; /* hard coded deadzone */ + /* hard coded deadzone */ + if (abs(val) > 0x1000) + return val; + return 0; } #define PSX_H_GET(a) (a & 0x0F) /*HAT MASK = 0x0F */ diff --git a/input/connect/connect_retrode.c b/input/connect/connect_retrode.c index 5289cc8fe6..1dd569f607 100644 --- a/input/connect/connect_retrode.c +++ b/input/connect/connect_retrode.c @@ -97,15 +97,17 @@ static int16_t hidpad_retrode_get_axis(void *data, unsigned axis) /* map Retrode values to a known gamepad (VID=0x0079, PID=0x0011) */ if (val == 0x9C) - val = 0x00; /* axis=0 left, axis=1 up */ + val = 0x00; /* axis=0 left, axis=1 up */ else if (val == 0x64) - val = 0xFF; /* axis=0 right, axis=1 down */ + val = 0xFF; /* axis=0 right, axis=1 down */ else - val = 0x7F; /* no button pressed */ + val = 0x7F; /* no button pressed */ val = (val << 8) - 0x8000; - return (abs(val) > 0x1000) ? val : 0; + if (abs(val) > 0x1000) + return val; + return 0; } static void hidpad_retrode_packet_handler(void *data, uint8_t *packet, uint16_t size) diff --git a/input/connect/connect_snesusb.c b/input/connect/connect_snesusb.c index 314577d863..547b70df8a 100644 --- a/input/connect/connect_snesusb.c +++ b/input/connect/connect_snesusb.c @@ -82,7 +82,9 @@ static int16_t hidpad_snesusb_get_axis(void *data, unsigned axis) val = device->data[1 + axis]; val = (val << 8) - 0x8000; - return (abs(val) > 0x1000) ? val : 0; + if (abs(val) > 0x1000) + return val; + return 0; } static void hidpad_snesusb_packet_handler(void *data, uint8_t *packet, uint16_t size) diff --git a/input/connect/connect_wiiugca.c b/input/connect/connect_wiiugca.c index 357e479b58..012d29e6d0 100644 --- a/input/connect/connect_wiiugca.c +++ b/input/connect/connect_wiiugca.c @@ -95,7 +95,9 @@ static int16_t hidpad_wiiugca_get_axis(void *data, unsigned axis) else val = (val << 8) - 0x8000; - return (abs(val) > 0x1000) ? val : 0; + if (abs(val) > 0x1000) + return val; + return 0; } static void hidpad_wiiugca_packet_handler(void *data, uint8_t *packet, uint16_t size)