[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 0db24270 3/6: Use gcc-predefined endianness m
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 0db24270 3/6: Use gcc-predefined endianness macros consistently |
Date: |
Sun, 22 May 2022 11:33:06 -0400 (EDT) |
branch: master
commit 0db24270e611b9a10d59a2e337880f3b2e5b6ccc
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Use gcc-predefined endianness macros consistently
---
md5.cpp | 4 ++--
round_glibc.c | 25 ++++++++-----------------
test_coding_rules.cpp | 3 ---
3 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/md5.cpp b/md5.cpp
index 7807acbc..6324ca1f 100644
--- a/md5.cpp
+++ b/md5.cpp
@@ -74,9 +74,9 @@
#include "md5.hpp"
#if defined _LIBC
-# if __BYTE_ORDER__ == __BIG_ENDIAN
+# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
-# endif // __BYTE_ORDER__ == __BIG_ENDIAN
+# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#endif // defined _LIBC
/* intel x86 is little-endian */
diff --git a/round_glibc.c b/round_glibc.c
index e14bf5c2..37d17729 100644
--- a/round_glibc.c
+++ b/round_glibc.c
@@ -49,15 +49,6 @@
//
https://lists.freedesktop.org/archives/release-wranglers/2004-August/000925.html
typedef uint32_t u_int32_t;
-// This file is intended only for use with MinGW-w64, which is always
-// little endian. It seemed best to preserve alternative definitions
-// in case they're ever wanted for some unanticipated purpose, and
-// to provide these aliases mapping the macros used in the unmodified
-// sources to gcc's standard predefinitions:
-#define __FLOAT_WORD_ORDER __FLOAT_WORD_ORDER__
-#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
-#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
-
//
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/ieee754/dbl-64/s_round.c
/* Round double to integer away from zero. */
//
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/ieee754/flt-32/s_roundf.c
@@ -97,7 +88,7 @@ typedef uint32_t u_int32_t;
/* A union which permits us to convert between a double and two 32 bit
ints. */
-#if __FLOAT_WORD_ORDER == BIG_ENDIAN
+#if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
typedef union
{
double value;
@@ -108,9 +99,9 @@ typedef union
} parts;
uint64_t word;
} ieee_double_shape_type;
-#endif // __FLOAT_WORD_ORDER == BIG_ENDIAN
+#endif // __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
-#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
+#if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
typedef union
{
double value;
@@ -121,7 +112,7 @@ typedef union
} parts;
uint64_t word;
} ieee_double_shape_type;
-#endif // __FLOAT_WORD_ORDER == LITTLE_ENDIAN
+#endif // __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
/* Get two 32 bit ints from a double. */
@@ -178,7 +169,7 @@ do {
\
/* A union which permits us to convert between a long double and
three 32 bit ints. */
-#if __FLOAT_WORD_ORDER == BIG_ENDIAN
+#if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
typedef union
{
long double value;
@@ -190,9 +181,9 @@ typedef union
u_int32_t lsw;
} parts;
} ieee_long_double_shape_type;
-#endif // __FLOAT_WORD_ORDER == BIG_ENDIAN
+#endif // __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
-#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
+#if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
typedef union
{
long double value;
@@ -204,7 +195,7 @@ typedef union
unsigned int empty:16;
} parts;
} ieee_long_double_shape_type;
-#endif // __FLOAT_WORD_ORDER == LITTLE_ENDIAN
+#endif // __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
/* Get three 32 bit ints from a double. */
diff --git a/test_coding_rules.cpp b/test_coding_rules.cpp
index fc17b618..622b69fd 100644
--- a/test_coding_rules.cpp
+++ b/test_coding_rules.cpp
@@ -998,9 +998,6 @@ bool check_reserved_name_exception(std::string const& s)
// Compiler specific: glibc.
,"_GLIBCXX_DEBUG"
,"_LIBC"
- ,"__BIG_ENDIAN"
- ,"__FLOAT_WORD_ORDER"
- ,"__LITTLE_ENDIAN"
// Compiler specific: EDG; hence, como, and also libcomo.
,"__asm"
,"__COMO__"
- [lmi-commits] [lmi] master updated (82468e66 -> 869fd439), Greg Chicares, 2022/05/22
- [lmi-commits] [lmi] master 3539d95d 1/6: Allow another common macro, Greg Chicares, 2022/05/22
- [lmi-commits] [lmi] master 26ed20eb 4/6: Get rid of another macro, Greg Chicares, 2022/05/22
- [lmi-commits] [lmi] master 869fd439 6/6: Avoid "pragma GCC" with clang, Greg Chicares, 2022/05/22
- [lmi-commits] [lmi] master 34f7a991 5/6: Adapt to a difference between clang and gcc, Greg Chicares, 2022/05/22
- [lmi-commits] [lmi] master adc03db3 2/6: Replace a macro with an equivalent predefined by gcc, Greg Chicares, 2022/05/22
- [lmi-commits] [lmi] master 0db24270 3/6: Use gcc-predefined endianness macros consistently,
Greg Chicares <=