From a4002ade3a8ad7cac29058a15ca866f5c068b25d Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Mon, 30 Jul 2018 17:01:15 -0500 Subject: [PATCH] Added unchecked block around axis scaling --- DS4Windows/DS4Control/ControlService.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index f20936c..bd2db16 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -657,13 +657,16 @@ namespace DS4Windows private short AxisScale(Int32 Value, Boolean Flip) { - Value -= 0x80; + unchecked + { + Value -= 0x80; - //float temp = (Value - (-128)) / (float)inputResolution; - float temp = (Value - (-128)) * reciprocalInputResolution; - if (Flip) temp = (temp - 0.5f) * -1.0f + 0.5f; + //float temp = (Value - (-128)) / (float)inputResolution; + float temp = (Value - (-128)) * reciprocalInputResolution; + if (Flip) temp = (temp - 0.5f) * -1.0f + 0.5f; - return (short) (temp* outputResolution + (-32768)); + return (short)(temp * outputResolution + (-32768)); + } } private void CheckProfileOptions(int ind, DS4Device device, bool startUp=false)