Patch to mouse accel code (integer version)
Jan Brunner
brunner at intergga.ch
Sun Nov 14 16:46:10 PST 2004
>> That said, code which can easily avoid FP is always nicer.
>
>
> I'll think about it tomorrow. I estimate that the code is going to get
> messy without FP but maybe I find something nice.
I implemented the patch without floats and I think it's not messy at all
and probably quite a bit faster even on systems with FPUs. When first
thinking about an integer version without writing the code, I didn't see
that there's still going to be only one division per axis because the
original division gets "delayed".
The Bugzilla entry:
http://freedesktop.org/bugzilla/show_bug.cgi?id=1688
The patch:
http://freedesktop.org/bugzilla/attachment.cgi?id=1308
I don't know whether the 2 new variables are named in a good way. Feel
free to change.
PS: Thanks Jim Gettis for making me research a bit about why casts from
float to int are so expensive. (It's because the CPUs are normally set
to round to the nearest integer but the C standard (and the old code)
requires rounding down. Changing the mode and resetting it requires a
lot of cycles.)
--
Best Regards,
Jan Brunner <brunner at intergga.ch>
More information about the xorg
mailing list