Input: Use trunc instead of lrintf in acceleration code

For compatibility with all the rest of the input code.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
This commit is contained in:
Daniel Stone 2011-06-09 15:26:55 +01:00 committed by Peter Hutterer
parent e1df51421b
commit 8a4a4e1b8a

View File

@ -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;
}