OXYGENHUB
# bd65c0cc08c7 x16-emulator / src / endian.h
547 B · Objective-C · last changed chore(): initial commit 15 days ago source blame history raw
1
#pragma once
2
3
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
4
#define LOW_HIGH_UNION(name, low, high) \
5
    union { \
6
        struct { \
7
            uint8_t low; \
8
            uint8_t high; \
9
        }; \
10
        uint16_t name; \
11
    }
12
#define ENDIAN_STRUCT_MEMBERS(low, high) \
13
    low; \
14
    high
15
#else
16
#define LOW_HIGH_UNION(name, low, high) \
17
    union { \
18
        struct { \
19
            uint8_t high; \
20
            uint8_t low; \
21
        }; \
22
        uint16_t name; \
23
    }
24
#define ENDIAN_STRUCT_MEMBERS(low, high) \
25
    high; \
26
    low
27
#endif