GBA: Better portable GBARTC packing

This commit is contained in:
Jeffrey Pfau 2015-06-08 01:25:36 -07:00
parent cd2533edce
commit 91a66c9346
2 changed files with 7 additions and 13 deletions

View File

@ -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);

View File

@ -86,11 +86,9 @@ typedef int32_t ssize_t;
#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