GBA: Better portable GBARTC packing
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Jun 2015 01:25:36 -0700
2 files changed,
7 insertions(+),
13 deletions(-)
M
src/gba/hardware.h
→
src/gba/hardware.h
@@ -74,22 +74,18 @@ DECL_BITS(RTCCommandData, Magic, 0, 4);
DECL_BITS(RTCCommandData, Command, 4, 3); DECL_BIT(RTCCommandData, Reading, 7); -#ifdef _MSC_VER -#pragma pack(push,1) -#endif +#pragma pack(push, 1) struct GBARTC { - int bytesRemaining; - int transferStep; - int bitsRead; - int bits; - int commandActive; + int32_t bytesRemaining; + int32_t transferStep; + int32_t bitsRead; + int32_t bits; + int32_t commandActive; RTCCommandData command; RTCControl control; uint8_t time[7]; -} ATTRIBUTE_PACKED; -#ifdef _MSC_VER +}; #pragma pack(pop) -#endif struct GBARumble { void (*setRumble)(struct GBARumble*, int enable);
M
src/util/common.h
→
src/util/common.h
@@ -86,11 +86,9 @@
#ifdef _MSC_VER #define ATTRIBUTE_UNUSED #define ATTRIBUTE_FORMAT(X, Y, Z) -#define ATTRIBUTE_PACKED #else #define ATTRIBUTE_UNUSED __attribute__((unused)) #define ATTRIBUTE_FORMAT(X, Y, Z) __attribute__((format(X, Y, Z))) -#define ATTRIBUTE_PACKED __attribute__((packed)) #endif #define DECL_BITFIELD(NAME, TYPE) typedef TYPE NAME