SCP: Add macro's to support packed structures for network traffic

This commit is contained in:
Mark Pizzolato 2020-03-10 11:26:23 -07:00
parent c30c88c24f
commit 77edf89ef5
2 changed files with 15 additions and 3 deletions

View file

@ -315,6 +315,21 @@ typedef uint32 t_addr;
#define SIM_NOINLINE
#endif
/* Packed structure support */
#ifdef _MSC_VER
# define PACKED_BEGIN __pragma( pack(push, 1) )
# define PACKED_END __pragma( pack(pop) )
#else
# define PACKED_BEGIN
#if defined(_WIN32)
# define PACKED_END __attribute__((gcc_struct, packed))
#else
# define PACKED_END __attribute__((packed))
#endif
#endif
/* Storage class modifier for weak link definition for sim_vm_init() */
#if defined(__cplusplus)

View file

@ -62,15 +62,12 @@ typedef uint32_t n_long; /* long as received from the net */
#ifdef _MSC_VER
# define PACKED_BEGIN __pragma( pack(push, 1) )
# define PACKED_END __pragma( pack(pop) )
# define QEMU_PACKED
#else
# define PACKED_BEGIN
#if defined(_WIN32)
# define PACKED_END __attribute__((gcc_struct, packed))
# define QEMU_PACKED __attribute__((gcc_struct, packed))
#else
# define PACKED_END __attribute__((packed))
# define QEMU_PACKED __attribute__((packed))
#endif
#endif