summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Thum <simon.thum@gmx.de>2009-04-30 12:58:48 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2009-05-07 16:49:02 +1000
commit35fce4e5c7fa34f98b3e4010c6cb09ce38a9205c (patch)
treedbc654d2c9e950b1fe5f664665a7ae38bfee7e17
parent1b1b20d6e3e696e4437a9ef56128cde70a485f66 (diff)
dix: fix warning in pointer acceleration
newer gcc's warn against how this cast is done (though it eludes me why), and lrintf() is also faster especially on insane processors like the P4 (http://www.mega-nerd.com/FPcast). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/ptrveloc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 99efc794c..0a9a22ec2 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -994,14 +994,20 @@ acceleratePointerPredictable(
if (dx) {
tmp = mult * fdx + pDev->last.remainder[0];
- *px = (int)roundf(tmp);
+ /* Since it may not be apparent: lrintf() does not offer
+ * strong statements about rounding; however because we
+ * process each axis conditionally, there's no danger
+ * of a toggling remainder. Its lack of guarantees hopefully
+ * makes it faster on the average target. */
+ *px = lrintf(tmp);
pDev->last.remainder[0] = tmp - (float)*px;
}
if (dy) {
tmp = mult * fdy + pDev->last.remainder[1];
- *py = (int)roundf(tmp);
+ *py = lrintf(tmp);
pDev->last.remainder[1] = tmp - (float)*py;
}
+ DebugAccelF("pos (%i | %i) remainders x: %.3f y: %.3f delta x:%.3f y:%.3f\n", *px, *py, pDev->last.remainder[0], pDev->last.remainder[1], fdx, fdy);
}
}
}