diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2022-03-24 09:42:45 +0000 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2022-03-24 10:13:52 +0000 |
commit | 02ea538ed08a1b3dd5acc016762e951ff006299f (patch) | |
tree | dc7678b9b272860e83a5095d59f6e1cf3075a5f0 | |
parent | d101b2bb6dc98050f8f1b04d9d2bfeeff5a120c7 (diff) | |
download | libparserutils-02ea538ed08a1b3dd5acc016762e951ff006299f.tar.gz libparserutils-02ea538ed08a1b3dd5acc016762e951ff006299f.tar.bz2 |
Endian: Improve host endian detection for older GCCs.
Co-authored-by: John-Mark Bell <jmb@netsurf-browser.org>
-rw-r--r-- | src/utils/endian.h | 4 |
1 files 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) |