From 02ea538ed08a1b3dd5acc016762e951ff006299f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 24 Mar 2022 09:42:45 +0000 Subject: Endian: Improve host endian detection for older GCCs. Co-authored-by: John-Mark Bell --- src/utils/endian.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/endian.h b/src/utils/endian.h index 8a4760b..3227c30 100644 --- a/src/utils/endian.h +++ b/src/utils/endian.h @@ -10,9 +10,9 @@ static inline bool endian_host_is_le(void) { - static uint32_t magic = 0x10000002; + const uint16_t test = 1; - return (((uint8_t *) &magic)[0] == 0x02); + return ((const uint8_t *) &test)[0]; } static inline uint32_t endian_swap(uint32_t val) -- cgit v1.2.3