From b320babd590a54588a3f568aa31f854133e850f2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 24 Mar 2022 09:41:13 +0000 Subject: Endian: Improve host endian detection for older GCCs. Co-authored-by: John-Mark Bell --- include/nsutils/endian.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nsutils/endian.h b/include/nsutils/endian.h index 0e4bad0..a15c7e2 100644 --- a/include/nsutils/endian.h +++ b/include/nsutils/endian.h @@ -23,9 +23,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]; } /** -- cgit v1.2.3