[PATCH 20/20] dix: reduce scope of tmp and mult.
Daniel Stone
daniel at fooishbar.org
Wed Apr 20 01:21:19 PDT 2011
Hi,
On Wed, Apr 20, 2011 at 04:28:29PM +1000, Peter Hutterer wrote:
> index 0741604..4901d6a 100644
> --- a/dix/ptrveloc.c
> +++ b/dix/ptrveloc.c
> @@ -1122,7 +1122,6 @@ acceleratePointerPredictable(
> ValuatorMask* val,
> CARD32 evtime)
> {
> - float tmp, mult; /* no need to init */
> int dx = 0, dy = 0, tmpi;
> DeviceVelocityPtr velocitydata = GetDevicePredictableAccelData(dev);
> Bool soften = TRUE;
> @@ -1150,6 +1149,8 @@ acceleratePointerPredictable(
> }
>
> if (dev->ptrfeed && dev->ptrfeed->ctrl.num) {
> + float mult;
Couldn't you just put tmp here as well, rather than put it twice below:
> @@ -1167,6 +1168,7 @@ acceleratePointerPredictable(
> /* Calculate the new delta (with accel) and drop it back
> * into the valuator masks */
> 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
> @@ -1178,6 +1180,7 @@ acceleratePointerPredictable(
> dev->last.remainder[0] = tmp - (float)tmpi;
> }
> if (dy) {
> + float tmp;
> tmp = mult * fdy + dev->last.remainder[1];
> tmpi = lrintf(tmp);
> valuator_mask_set(val, 1, tmpi);
But it doesn't matter really. With or without that, for the series:
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
I'd also found and written 01/20 independently (it's sitting in another
branch) while having a similar 'wtf is all this?' excursion through the
pointer code, and had wondered how it worked!
Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110420/b6c3e6c7/attachment-0001.pgp>
More information about the xorg-devel
mailing list