diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/bin.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/shared/bin.h b/shared/bin.h index a849d53..4f7db81 100644 --- a/shared/bin.h +++ b/shared/bin.h @@ -13,13 +13,12 @@ extern uint8_t g_w2_endianness; -#define W2_CAST_BIN(type, in, out) type *out = (type*) &in->data; -#define W2_CREATE_MSG_BIN(type, normal, bin) \ - W2_CREATE_MSG_SIZE_BIN(type, sizeof(type), normal, bin) -#define W2_CREATE_MSG_SIZE_BIN(type, size, normal, bin) \ - w2_s_bin* bin = malloc(sizeof(w2_s_bin) + size); \ - bin->bytes = size; \ - type* normal = (type*) &bin->data; +#define W2_CAST_BIN(type, in, out) type *out = (type *)&in->data; +#define W2_CREATE_MSG_BIN(type, normal, bin) W2_CREATE_MSG_SIZE_BIN(type, sizeof(type), normal, bin) +#define W2_CREATE_MSG_SIZE_BIN(type, size, normal, bin) \ + w2_s_bin *bin = malloc(sizeof(w2_s_bin) + size); \ + bin->bytes = size; \ + type *normal = (type *)&bin->data; typedef struct { uint16_t bytes; |