# ensure we don't clash with any pre-supplied autoconf ones.
+# FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
+# ----------------------------------
+# Little endian Arm on Linux with some ABIs has big endian word order
+# in doubles. Define FLOAT_WORDS_BIGENDIAN if this is the case.
+AC_DEFUN([FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN],
+ [AC_CACHE_CHECK([whether float word order is big endian], [fptools_cv_float_word_order_bigendian],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <endian.h>],
+ [#if defined(__FLOAT_WORD_ORDER) && __FLOAT_WORD_ORDER == BIG_ENDIAN
+ return 0;
+ #else
+ not float word order big endian
+ #endif]
+ )],
+ [fptools_cv_float_word_order_bigendian=yes],
+ [fptools_cv_float_word_order_bigendian=no])
+ ])
+ case $fptools_cv_float_word_order_bigendian in
+ yes)
+ AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
+ [Define to 1 if your processor stores words of floats with
+ the most significant byte first]) ;;
+ esac
+])
+
+
# FP_EVAL_STDERR(COMMAND)
# -----------------------
# Eval COMMAND, save its stderr (without lines resulting from shell tracing)
dnl ** are we big endian?
AC_C_BIGENDIAN
+FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
dnl ** check for leading underscores in symbol names
FP_LEADING_UNDERSCORE
#define FMSBIT 0x80000000
#endif
-#ifdef WORDS_BIGENDIAN
+#if defined(WORDS_BIGENDIAN) || defined(FLOAT_WORDS_BIGENDIAN)
#define L 1
#define H 0
#else
unsigned int mantissa0:20;
unsigned int mantissa1:32;
#else
+#if FLOAT_WORDS_BIGENDIAN
+ unsigned int mantissa0:20;
+ unsigned int exponent:11;
+ unsigned int negative:1;
+ unsigned int mantissa1:32;
+#else
unsigned int mantissa1:32;
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
#endif
+#endif
} ieee;
/* This format makes it easier to see if a NaN is a signalling NaN. */
struct {
unsigned int mantissa0:19;
unsigned int mantissa1:32;
#else
+#if FLOAT_WORDS_BIGENDIAN
+ unsigned int mantissa0:19;
+ unsigned int quiet_nan:1;
+ unsigned int exponent:11;
+ unsigned int negative:1;
+ unsigned int mantissa1:32;
+#else
unsigned int mantissa1:32;
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
unsigned int negative:1;
#endif
+#endif
} ieee_nan;
};