16static inline uint32_t lw_le(uint32_t data)
21 ptr = (uint8_t*) &data;
23 val = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
28static inline uint16_t lh_le(uint16_t data)
33 ptr = (uint8_t*) &data;
35 val = ptr[0] | (ptr[1] << 8);
40static inline uint32_t lw_be(uint32_t data)
45 ptr = (uint8_t*) &data;
47 val = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3];
52static inline uint16_t lh_be(uint16_t data)
57 ptr = (uint8_t*) &data;
59 val = (ptr[0] << 16) | ptr[1];
64#define LW_LE(x) (lw_le((x)))
65#define LW_BE(x) (lw_be((x)))
66#define LH_LE(x) (lh_le((x)))
67#define LH_BE(x) (lh_be((x)))
69#define LW(x) (LW_LE(x))
70#define LH(x) (LH_LE(x))
73static inline void sw_le(uint8_t *data, uint32_t val)
75 uint8_t* ptr = (uint8_t*) data;
77 ptr[0] = (uint8_t) (val & 0xFF);
78 ptr[1] = (uint8_t) ((val >> 8) & 0xFF);
79 ptr[2] = (uint8_t) ((val >> 16) & 0xFF);
80 ptr[3] = (uint8_t) ((val >> 24) & 0xFF);
83static inline void sh_le(uint8_t *data, uint16_t val)
85 uint8_t *ptr = (uint8_t*) data;
87 ptr[0] = (uint8_t) (val & 0xFF);
88 ptr[1] = (uint8_t) ((val >> 8) & 0xFF);
91static inline void sw_be(uint8_t *data, uint32_t val)
93 uint8_t *ptr = (uint8_t*) data;
95 ptr[0] = (uint8_t) ((val >> 24) & 0xFF);
96 ptr[1] = (uint8_t) ((val >> 16) & 0xFF);
97 ptr[2] = (uint8_t) ((val >> 8) & 0xFF);
98 ptr[3] = (uint8_t) (val & 0xFF);
101static inline void sh_be(uint8_t *data, uint16_t val)
103 uint8_t* ptr = (uint8_t*) data;
105 ptr[0] = (uint8_t) ((val >> 8) & 0xFF);
106 ptr[1] = (uint8_t) (val & 0xFF);
109#define SW_LE(x, v) (sw_le((uint8_t *)(x), (v)))
110#define SW_BE(x, v) (sw_be((uint8_t *)(x), (v)))
111#define SH_LE(x, v) (sh_le((uint8_t *)(x), (v)))
112#define SH_BE(x, v) (sh_be((uint8_t *)(x), (v)))
114#define SW(x, v) (SW_LE(x, v))
115#define SH(x, v) (SH_LE(x, v))