This is an automated email from the ASF dual-hosted git repository.
wkaras pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new f0cf0313df Use GCC stardard pre-defined macros to determine endianess.
(#11186)
f0cf0313df is described below
commit f0cf0313df3d19ea1b69f7b0937fe7647ce87e5d
Author: Walt Karas <[email protected]>
AuthorDate: Mon Apr 1 11:16:34 2024 -0400
Use GCC stardard pre-defined macros to determine endianess. (#11186)
---
lib/swoc/include/swoc/swoc_ip_util.h | 2 +-
src/tscore/MMH.cc | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/swoc/include/swoc/swoc_ip_util.h
b/lib/swoc/include/swoc/swoc_ip_util.h
index 78016bf0b8..40d6074012 100644
--- a/lib/swoc/include/swoc/swoc_ip_util.h
+++ b/lib/swoc/include/swoc/swoc_ip_util.h
@@ -65,7 +65,7 @@ inline bool is_private_network_order(in6_addr const& addr) {
return (addr.s6_addr[0] & 0xFE) == 0xFC; // fc00::/7
}
-#if BYTE_ORDER == LITTLE_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
inline bool is_loopback_network_order(in_addr_t addr) {
return (addr & 0xFF) == 0x7F;
diff --git a/src/tscore/MMH.cc b/src/tscore/MMH.cc
index ec04feb266..b667763e92 100644
--- a/src/tscore/MMH.cc
+++ b/src/tscore/MMH.cc
@@ -234,11 +234,14 @@ ink_code_incr_MMH_update(MMH_CTX *ctx, const char
*ainput, int input_length)
// check alignment
int alignment = static_cast<int>((intptr_t)in & 0x3);
if (alignment) {
-#if defined(_BIG_ENDIAN)
+#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) &&
defined(__ORDER_LITTLE_ENDIAN__)
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define big_endian 1
-#elif defined(_LITTLE_ENDIAN)
+#else
#define big_endian 0
+#endif
#else
+#warning "compiler is not GCC compatible"
unsigned int endian = 1;
int big_endian = !*reinterpret_cast<char *>(&endian);
#endif