1
0

fwrite_le.h: reduce scope of private macros

This commit is contained in:
Intel A80486DX2-66 2024-07-05 15:21:01 +03:00
parent bbb7b2a476
commit 7a107a85de
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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;