Defs: types
Macros
Section titled “Macros”pad_nam2
Section titled “pad_nam2”Giving a type to padding bytes is misguiding, let’s hide it in a macro
#define pad_nam2 ((c)) _ ## cbyte_union
Section titled “byte_union”byte_union() - union between an uint8_t ‘byte’ element and a bit field
#define byte_union ((name, fields)) \ union { \ uint8_t byte; \ struct { fields } GPACKED(1); \ } GPACKED(1) nameword_union
Section titled “word_union”word_union() - union between an uint16_t ‘word’ element and a bit field
#define word_union ((name, fields)) \ union { \ uint16_t word; \ struct { fields } GPACKED(2); \ } GPACKED(2) namelword_union
Section titled “lword_union”lword_union() - union between an uint32_t ‘lword’ element and a bit field
#define lword_union ((name, fields)) \ union { \ uint32_t lword; \ struct { fields } GPACKED(4); \ } GPACKED(4) name#define pad_name ((c)) pad_nam2(c)#define pad ((bytes)) uint8_t pad_name(__COUNTER__)[bytes]Fixed-width types for bit fields are quite meaningless
typedef unsigned int uinttypedef unsigned int uinttypedef uint8_t u8typedef uint16_t u16typedef uint32_t u32typedef uint64_t u64typedef int8_t i8typedef int16_t i16typedef int32_t i32typedef int64_t i64