fsm/src/registers/pack.h
2021-10-23 13:15:32 +02:00

23 lines
566 B
C

#pragma once
#include "stdint.h"
#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 4)) || __clang__ || __TINYC__
#if defined(__TINYC__)
#pragma pack(1)
#endif
#define PACKED(x, s) union { \
s value; \
x __attribute__((packed)) fields; \
}
#define PACKEDM(x, s, n) union { \
s value[n]; \
x __attribute__((packed)) fields; \
}
#else
#error "Packed bit-fields of type char were not properly bit-packed on many targets prior to GCC 4.4, upgrade to GCC >= 4.4."
#endif