Peter Hutterer <[email protected]> writes:

> The double_to_f1616() functions do the same thing, and they're tested.
>
> Signed-off-by: Peter Hutterer <[email protected]>
> ---
> 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))

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

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to