[PATCH] input: drop FP16161 macro

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 6 16:41:30 PST 2012


On Tue, Nov 06, 2012 at 09:23:01PM +0100, Søren Sandmann wrote:
> Peter Hutterer <peter.hutterer at who-t.net> writes:
> 
> > The double_to_f1616() functions do the same thing, and they're tested.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > Turns out we already have these functions and the macro was just a leftover
> > from earlier, happier times.
> 
> Is there any reason to not just use the pixman_double_to_fixed() macro:
> 
>     #define pixman_double_to_fixed(d)  ((pixman_fixed_t) ((d) * 65536.0))

Jeremy, do you remember any specific reason why we didn't end up using the
pixman macro for this?

Cheers,
   Peter

> 
> The double_to_fp1616() function looks rather complicated and slow:
> 
>     FP1616
>     double_to_fp1616(double in)
>     {
>         FP1616 ret;
>         int32_t integral;
>         double tmp;
>         uint32_t frac_d;
>     
>         tmp = floor(in);
>         integral = (int32_t) tmp;
>     
>         tmp = (in - integral) * (1UL << 16);        /* Optimized: ldexp(in - integral, 16) */
>         frac_d = (uint16_t) tmp;
>     
>         ret = integral << 16;
>         ret |= frac_d & 0xffff;
>         return ret;
>     }
> 
> 
> Søren
> 
> 


More information about the xorg-devel mailing list