[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 38dd359d 04/13: Apply 'fdlibm*.c' changes to
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 38dd359d 04/13: Apply 'fdlibm*.c' changes to 'fdlibm.h' |
Date: |
Mon, 23 May 2022 17:40:26 -0400 (EDT) |
branch: master
commit 38dd359d4342b09bc338b6e8e92706283d7cc72e
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Apply 'fdlibm*.c' changes to 'fdlibm.h'
---
fdlibm.h.txt | 41 ++++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/fdlibm.h.txt b/fdlibm.h.txt
index d44712a9..5a0be7a0 100644
--- a/fdlibm.h.txt
+++ b/fdlibm.h.txt
@@ -5,28 +5,31 @@
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
- but these catch some common cases. */
+// Apparently the clang maintainers believe that floating-point
+// endianness is necessarily the same as integer endianness.
+#if defined __clang__
+# if !defined __FLOAT_WORD_ORDER__ && defined __BYTE_ORDER__
+# define __FLOAT_WORD_ORDER__ __BYTE_ORDER__
+# endif // !defined __FLOAT_WORD_ORDER__ && defined __BYTE_ORDER__
+#endif // defined __clang__
-#if defined(i386) || defined(i486) || \
- defined(intel) || defined(x86) || defined(i86pc) || \
- defined(__alpha) || defined(__osf__)
-#define __LITTLE_ENDIAN
-#endif
+#if !defined __FLOAT_WORD_ORDER__ || \
+ !defined __ORDER_BIG_ENDIAN__ || \
+ !defined __ORDER_LITTLE_ENDIAN__
+# error Expected endianness macros not defined.
+#endif // expected endianness macros not defined
-#ifdef __LITTLE_ENDIAN
-#define __HI(x) *(1+(int*)&x)
-#define __LO(x) *(int*)&x
-#define __HIp(x) *(1+(int*)x)
-#define __LOp(x) *(int*)x
-#else
-#define __HI(x) *(int*)&x
-#define __LO(x) *(1+(int*)&x)
-#define __HIp(x) *(int*)x
-#define __LOp(x) *(1+(int*)x)
-#endif
+#if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
+# define FDLIBM_HI(x) *(1+(int*)&x)
+# define FDLIBM_LO(x) *(int*)&x
+#elif __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
+# define FDLIBM_HI(x) *(int*)&x
+# define FDLIBM_LO(x) *(1+(int*)&x)
+#else // unknown endianness
+# error Unknown endianness.
+#endif // unknown endianness
- [lmi-commits] [lmi] master updated (ad1f8a2f -> 599c44b7), Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master 38dd359d 04/13: Apply 'fdlibm*.c' changes to 'fdlibm.h',
Greg Chicares <=
- [lmi-commits] [lmi] master a456d40d 03/13: Expunge unwanted part of fdlibm header, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master 9d7e3be1 02/13: Import header from fdlibm, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master e5850c2a 12/13: Import Naohiko Shimizu's NetBSD performance improvements, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master bfb73bb2 09/13: Use fdlibm header more broadly, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master 599c44b7 13/13: Draw attention to atrocious type puns, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master 164db076 10/13: Assume __STDC__ for fdlibm, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master 7d5c739b 01/13: Expunge unused declarations and macro, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master d7294669 06/13: Add include guards; include a header required by lmi, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master adf263fe 11/13: Assume __STDC__ everywhere appropriate, Greg Chicares, 2022/05/23
- [lmi-commits] [lmi] master edb56e9b 05/13: Add license and copyright boilerplate, Greg Chicares, 2022/05/23