[dinput] map_axis must be able to work with LONG's value range

Christoph Frick frick at sc-networks.de
Fri Jul 7 03:01:42 CDT 2006


I decided to go with longlong instead of floats - but this now works
even with "big" numbers (e.g. 0-2**16 wmin/wmax)

License: LGPL
ChangeLog:
2006-07-05  Christoph Frick <rid at zefix.tv>
	map_axis must handle the whole LONG range of values

 dlls/dinput/joystick_linuxinput.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

-- 

diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 727fac1..edbe5ba 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -664,7 +664,7 @@ map_axis(JoystickImpl* This, int axis, i
     if (xmin == xmax) return val;
 
     /* map the value from the hmin-hmax range into the wmin-wmax range */
-    ret = ((val-hmin) * (wmax-wmin)) / (hmax-hmin) + wmin;
+    ret = (((LONGLONG)(val-hmin) * (LONGLONG)(wmax-wmin)) / (LONGLONG)(hmax-hmin)) + wmin;
 
     TRACE("xmin=%d xmax=%d hmin=%d hmax=%d wmin=%d wmax=%d val=%d ret=%d\n", xmin, xmax, hmin, hmax, wmin, wmax, val, ret);
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060707/46164178/attachment.pgp


More information about the wine-patches mailing list