[cairo] Speeding up _cairo_fixed_from_double

Michael Sweet mike at easysw.com
Thu Oct 26 16:37:17 PDT 2006

Daniel Amelang wrote:
>> Keep in mind that configure-time endian checks are unreliable on
>> Mac OS X because a single executable may contain objects for multiple
>> architectures (right now 32+64 bit Intel and PPC)...
> AFAIK, the existence of fat binaries doesn't interfere with autoconf's
> job. We're not building fat binaries during the configure stage, and
> we don't compile to a fat binary. In addition, that would be a general
> autoconf on OS X issue, not a cairo thing.

Well, the side effect is that the autoconf test will report the
endianess of the host you are compiling on.  The problem is akin to
cross-compiling Cairo...

For other projects that have code endian-specific code, we have to
patch the configure-generated define with some OSX conditional
directives, e.g.:

     #ifdef __APPLE__
     #  ifdef __i386__
     #    define LITTLE_ENDIAN
     #    undef BIG_ENDIAN
     #  else
     #    undef LITTLE_ENDIAN
     #    define BIG_ENDIAN
     #  endif /* __i386__ */
     #endif /* __APPLE__ */

The short of it is this: if you use a configure-time test, you'll
want a configure option to override the automatic test, and you'll
want to incorporate conditional code like the above at some point,
as Universal/fat binaries are pretty much required for OSX apps now,
and running lipo from files on another system is no way to build

The other ways to handle this is to use a run-time endian check that
is triggered the first time through the function, or write code that
is endian-neutral...

Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software        http://www.easysw.com

More information about the cairo mailing list