Thanks for the response. So this looks like it will pack each member into a uint32_t of its own, which effectively makes the packed data 5 ints of msgpack data.
I was also thinking about how to pack a 5 member bit field like Bits into just 1 int of msgpack format data, since the bitfield is meant to only occupy 1 int of space. Our solution for this was to use a union pattern, where one member of the union is this Bits struct, and one is an int acting as "raw" data. Then we use the bitfield for our internal code, but use msgpack to pack the "raw" data when sending a message.
#include
union dataForm{
struct Bits {
uint32_t opCode : 5;
uint32_t header : 3;
uint32_t source : 5;
uint32_t destination : 5;
uint32_t offset : 13;
};
uint32_t raw;
};
|