[cairo] Speeding up _cairo_fixed_from_double

Jim Gettys jg at laptop.org
Sun Oct 29 11:04:40 PST 2006


Evil endianness trick from Xlib:

        int endian = 1; 

        if (*(char *) &endian)
            client.byteOrder = '\154'; /* 'l' */
        else
            client.byteOrder = '\102'; /* 'B' */

Even more fun about this, is that the compiler ends up optimizing
exactly what you'd like; everything is determinable at compile time, so
only the right assignment (or branch set of code) is emitted in the
generated code.

I'll take this over the typical if-def's configure options, and other
horrors any day.

Works fine when cross compiling too.
                             Regards,
                                      - Jim


If you don't succeed, try try again...  Was posting from an old address,
got moderated to death, fixed the address, forgot to wait for the
confirm, posted again, got moderated to death....

I guess no one deals with posting to the cairo list held for
moderation....


On Sun, 2006-10-29 at 13:00 -0500, Behdad Esfahbod wrote:
> On Sun, 2006-10-29 at 10:21 -0500, Michael Sweet wrote:
> > Jim Gettys wrote:
> > > Evil endianness trick from Xlib:
> >  > ...
> > 
> > I like it! :)
> 
> Care to share?  I don't think Jim's mail made it to the list.
> 
-- 
Jim Gettys
One Laptop Per Child




More information about the cairo mailing list