[PATCH v3 03/19] test endianness with __BYTE_ORDER__

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The detection of the native endianness is currently done by
testing if __BIG_ENDIAN__ is defined.

However, not all native big endian platforms define this macro.

Test the endianness with __BYTE_ORDER__.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 machine.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/machine.h b/machine.h
index 1eacb556e..522f9ba08 100644
--- a/machine.h
+++ b/machine.h
@@ -1,7 +1,7 @@
 #ifndef MACHINE_H
 #define MACHINE_H
 
-#ifdef __BIG_ENDIAN__
+#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
 #define ARCH_BIG_ENDIAN 1
 #else
 #define ARCH_BIG_ENDIAN 0
-- 
2.19.2




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux