fwrite_le.*: rename ifeq_u32_ret
to ifeq_b32_ret
This commit is contained in:
parent
24317101c0
commit
a62c598c39
@ -15,7 +15,7 @@
|
|||||||
#define ORDER_NATIVE_U32 0x01234567
|
#define ORDER_NATIVE_U32 0x01234567
|
||||||
#define ORDER_LITTLE_ENDIAN_S4 "\x67\x45\x23\x01"
|
#define ORDER_LITTLE_ENDIAN_S4 "\x67\x45\x23\x01"
|
||||||
#define ORDER_BIG_ENDIAN_S4 "\x01\x23\x45\x67"
|
#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);
|
int detect_endianness(void);
|
||||||
size_t fwrite_le(void* ptr, size_t size, size_t count, FILE* stream);
|
size_t fwrite_le(void* ptr, size_t size, size_t count, FILE* stream);
|
||||||
|
@ -4,8 +4,8 @@ int detect_endianness(void) {
|
|||||||
volatile uint32_t native_order_value = ORDER_NATIVE_U32;
|
volatile uint32_t native_order_value = ORDER_NATIVE_U32;
|
||||||
uint8_t* as_bytes = (uint8_t*)&native_order_value;
|
uint8_t* as_bytes = (uint8_t*)&native_order_value;
|
||||||
|
|
||||||
ifeq_u32_ret(as_bytes, ORDER_LITTLE_ENDIAN_S4, DETECTED_LITTLE_ENDIAN);
|
ifeq_b32_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_BIG_ENDIAN_S4, DETECTED_BIG_ENDIAN );
|
||||||
return UNSUPPORTED_ENDIANNESS;
|
return UNSUPPORTED_ENDIANNESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user