diff options
author | Neil Roberts <neil@linux.intel.com> | 2013-07-03 17:37:48 +0100 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2013-07-04 12:06:08 +0100 |
commit | 6f1debaa34785ad639861078584677a9de645283 (patch) | |
tree | 8d4267082fe3a77e45a625ee09bb11d00cf68619 | |
parent | 43e389f3feb2dd4348b26b15627dc7d7e958197d (diff) | |
download | cogl-6f1debaa34785ad639861078584677a9de645283.tar.gz |
Include endian.h before checking __FLOAT_WORD_ORDER
CoglFixed was trying to use the __FLOAT_WORD_ORDER macro in order to
do some fast float conversions but it wasn't including any header that
could define it so it was giving an annoying warning. This patch
checks for the macro in endian.h in the configure script and only
checks its value if it's available.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 9730b9d6a6222ff5edd00d54110a3dc9ce407c03)
-rw-r--r-- | cogl/cogl-fixed.c | 8 | ||||
-rw-r--r-- | configure.ac | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/cogl/cogl-fixed.c b/cogl/cogl-fixed.c index a144d840..4d921554 100644 --- a/cogl/cogl-fixed.c +++ b/cogl/cogl-fixed.c @@ -30,6 +30,10 @@ #include <glib-object.h> #include <gobject/gvaluecollector.h> +#ifdef HAVE_FLOAT_WORD_ORDER +#include <endian.h> +#endif + #include "cogl-fixed.h" /* pre-computed sin table for 1st quadrant @@ -306,6 +310,7 @@ static const double _magic = 68719476736.0 * 1.5; * * FIXME - this should go inside the configure.ac */ +#ifdef HAVE_FLOAT_WORD_ORDER #if (__FLOAT_WORD_ORDER == 1234) #define _COGL_MAN 0 #elif (__FLOAT_WORD_ORDER == 4321) @@ -313,6 +318,9 @@ static const double _magic = 68719476736.0 * 1.5; #else #define COGL_NO_FAST_CONVERSIONS #endif +#else /* HAVE_FLOAT_WORD_ORDER */ +#define COGL_NO_FAST_CONVERSIONS +#endif /* HAVE_FLOAT_WORD_ORDER */ /* * cogl_double_to_fixed : diff --git a/configure.ac b/configure.ac index 4ba85b8a..24220235 100644 --- a/configure.ac +++ b/configure.ac @@ -1167,7 +1167,10 @@ dnl ================================================================ AC_PATH_X AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h limits.h unistd.h) - +AC_CHECK_HEADER([endian.h], + [AC_CHECK_DECL([__FLOAT_WORD_ORDER], + AC_DEFINE([HAVE_FLOAT_WORD_ORDER], [1], + [Has the __FLOAT_WORD_ORDER macro]))]) dnl ================================================================ dnl Checks for library functions. |