From 46b8287278f97dc8196809db1decc724f3898858 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Fri, 5 Jul 2024 15:21:01 +0300 Subject: [PATCH] fwrite_le.h: reduce scope of private macros --- include/fwrite_le.h | 5 ----- src/fwrite_le.c | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/fwrite_le.h b/include/fwrite_le.h index 6eb6fd1..58d6ef6 100644 --- a/include/fwrite_le.h +++ b/include/fwrite_le.h @@ -12,11 +12,6 @@ #define DETECTED_BIG_ENDIAN 1 #define UNSUPPORTED_ENDIANNESS -1 -#define ORDER_NATIVE_U32 0x01234567 -#define ORDER_LITTLE_ENDIAN_S4 "\x67\x45\x23\x01" -#define ORDER_BIG_ENDIAN_S4 "\x01\x23\x45\x67" -#define ifeq_b32_ret(lhs, rhs, value) if (!memcmp(lhs, rhs, 4)) return value; - int detect_endianness(void); size_t fwrite_le( #if FWRITE_LE_NO_MODIFICATION diff --git a/src/fwrite_le.c b/src/fwrite_le.c index e9beb3f..4a3b4cc 100644 --- a/src/fwrite_le.c +++ b/src/fwrite_le.c @@ -1,5 +1,10 @@ #include "fwrite_le.h" +#define ORDER_NATIVE_U32 0x01234567 +#define ORDER_LITTLE_ENDIAN_S4 "\x67\x45\x23\x01" +#define ORDER_BIG_ENDIAN_S4 "\x01\x23\x45\x67" +#define ifeq_b32_ret(lhs, rhs, value) if (!memcmp(lhs, rhs, 4)) return value; + int detect_endianness(void) { volatile uint32_t native_order_value = ORDER_NATIVE_U32; uint8_t* as_bytes = (uint8_t*)&native_order_value;