1From ff98a326d5faa585f0e15e51a558cc2c49aa8099 Mon Sep 17 00:00:00 2001 2From: Primoz Fiser <primoz.fiser@norik.com> 3Date: Fri, 23 Nov 2018 08:31:29 +0100 4Subject: [PATCH] Fix build on big endian architectures 5 6Signed-off-by: Primoz Fiser <primoz.fiser@norik.com> 7--- 8Upstream-Status: Pending 9 10 Common/DtaEndianFixup.h | 13 +++++++------ 11 1 file changed, 7 insertions(+), 6 deletions(-) 12 13diff --git a/Common/DtaEndianFixup.h b/Common/DtaEndianFixup.h 14index 58eb3ff..184fce0 100644 15--- a/Common/DtaEndianFixup.h 16+++ b/Common/DtaEndianFixup.h 17@@ -31,12 +31,11 @@ along with sedutil. If not, see <http://www.gnu.org/licenses/>. 18 //TODO: add a test on the endianess of the system and define 19 // empty macros if the system is big endian 20 #pragma once 21-#ifdef __gnu_linux__ 22-#include <endian.h> 23-#if __BYTE_ORDER != __LITTLE_ENDIAN 24-#error This code does not support big endian architectures 25-#endif 26-#endif 27+#if defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 28+#define SWAP16(x) x 29+#define SWAP32(x) x 30+#define SWAP64(x) x 31+#else 32 /** change the "endianess" of a 16bit field */ 33 #define SWAP16(x) ((uint16_t) ((x & 0x00ff) << 8) | ((x & 0xff00) >> 8)) 34 /** change the "endianess" of a 32bit field */ 35@@ -47,3 +46,5 @@ along with sedutil. If not, see <http://www.gnu.org/licenses/>. 36 ((uint64_t) (SWAP32((x & 0x00000000ffffffff)) << 32) | \ 37 ((uint64_t) (SWAP32((x >> 32))) ) \ 38 ) 39+ 40+#endif 41-- 422.7.4 43 44