[PATCH v2 13/28] Input: Use trunc instead of lrintf in acceleration code

Daniel Stone daniel at fooishbar.org
Thu Jun 9 10:17:21 PDT 2011


For compatibility with all the rest of the input code.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 dix/ptrveloc.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

v2: New.

diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index dfccf15..c506791 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -1167,19 +1167,14 @@ acceleratePointerPredictable(
                 if (dx) {
                     float tmp;
                     tmp = mult * fdx + dev->last.remainder[0];
-                    /* 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 likely
-                     * makes it faster on the average target. */
-                    tmpi = lrintf(tmp);
+                    tmpi = trunc(tmp);
                     valuator_mask_set(val, 0, tmpi);
                     dev->last.remainder[0] = tmp - (float)tmpi;
                 }
                 if (dy) {
                     float tmp;
                     tmp = mult * fdy + dev->last.remainder[1];
-                    tmpi = lrintf(tmp);
+                    tmpi = trunc(tmp);
                     valuator_mask_set(val, 1, tmpi);
                     dev->last.remainder[1] = tmp - (float)tmpi;
                 }
-- 
1.7.5.3



More information about the xorg-devel mailing list