From a62c598c3937489fd38da40257df1fe0be4cafe1 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Sat, 1 Jun 2024 10:01:38 +0300 Subject: [PATCH] fwrite_le.*: rename `ifeq_u32_ret` to `ifeq_b32_ret` --- include/fwrite_le.h | 2 +- src/fwrite_le.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fwrite_le.h b/include/fwrite_le.h index ec04e87..69e52b1 100644 --- a/include/fwrite_le.h +++ b/include/fwrite_le.h @@ -15,7 +15,7 @@ #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_u32_ret(lhs, rhs, value) if (!memcmp(lhs, rhs, 4)) return value; +#define ifeq_b32_ret(lhs, rhs, value) if (!memcmp(lhs, rhs, 4)) return value; int detect_endianness(void); size_t fwrite_le(void* ptr, size_t size, size_t count, FILE* stream); diff --git a/src/fwrite_le.c b/src/fwrite_le.c index 0fe8ec6..473124c 100644 --- a/src/fwrite_le.c +++ b/src/fwrite_le.c @@ -4,8 +4,8 @@ int detect_endianness(void) { volatile uint32_t native_order_value = ORDER_NATIVE_U32; uint8_t* as_bytes = (uint8_t*)&native_order_value; - ifeq_u32_ret(as_bytes, ORDER_LITTLE_ENDIAN_S4, DETECTED_LITTLE_ENDIAN); - ifeq_u32_ret(as_bytes, ORDER_BIG_ENDIAN_S4, DETECTED_BIG_ENDIAN ); + ifeq_b32_ret(as_bytes, ORDER_LITTLE_ENDIAN_S4, DETECTED_LITTLE_ENDIAN); + ifeq_b32_ret(as_bytes, ORDER_BIG_ENDIAN_S4, DETECTED_BIG_ENDIAN ); return UNSUPPORTED_ENDIANNESS; }