From f61f42c68fb4c288c2b388d278a8c3ce66d1e79c Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 8 Jan 2014 13:32:51 +0100 Subject: [PATCH] Simplify overlay analogs handling. --- retroarch.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/retroarch.c b/retroarch.c index 5c0d92b973..4e758b6473 100644 --- a/retroarch.c +++ b/retroarch.c @@ -636,15 +636,8 @@ static int16_t input_state(unsigned port, unsigned device, unsigned index, unsig { unsigned base = (index == RETRO_DEVICE_INDEX_ANALOG_RIGHT) ? 2 : 0; base += (id == RETRO_DEVICE_ID_ANALOG_Y) ? 1 : 0; - - // Simply adding here could overflow the int16_t. - int sum = res + driver.overlay_state.analog[base]; - if (sum > 0x7fff) - res = 0x7fff; - else if (sum < -0x7fff) - res = -0x7fff; - else - res = sum; + if (driver.overlay_state.analog[base]) + res = driver.overlay_state.analog[base]; } #endif