[cairo] Speeding up _cairo_fixed_from_double

Jim Gettys jg at laptop.org
Sun Oct 29 17:12:48 PST 2006


It should be.  The man page refers to dead code elimination (dce) being
the default at -O or higher.
                              - Jim


On Sun, 2006-10-29 at 16:59 -0500, Owen Taylor wrote:
> On Sun, 2006-10-29 at 14:04 -0500, Jim Gettys wrote:
> > 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 can't believe that I'm contributing more to this discussion... but
> I was skeptical that the compiler would actually optimize the above,
> so I tried it and GCC-4.1.1, at least, doesn't.
> 
> 					- Owen
> 
> 
-- 
Jim Gettys
One Laptop Per Child




More information about the cairo mailing list