>From 9ddcb814ede849b1a05538eba1ab7df76240a7e1 Mon Sep 17 00:00:00 2001 From: Simon Thum Date: Thu, 30 Apr 2009 12:58:48 +0200 Subject: [PATCH] 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). --- dix/ptrveloc.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index 6553772..89bf7d2 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -1006,14 +1006,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); } } } -- 1.6.0.6