diff --git a/include/villas/msg_format.h b/include/villas/msg_format.h index bf876093d..137cd376c 100644 --- a/include/villas/msg_format.h +++ b/include/villas/msg_format.h @@ -62,11 +62,17 @@ **/ struct msg { +#if BYTE_ORDER == LITTLE_ENDIAN + unsigned rsvd1 : 2; /**< Reserved bits */ + unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */ + unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */ +#elif BYTE_ORDER == BIG_ENDIAN unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */ unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */ unsigned rsvd1 : 2; /**< Reserved bits */ - unsigned rsvd2 : 8; /**< Reserved bits */ +#endif + uint8_t rsvd2; /**< Reserved bits */ uint16_t length; /**< The number of values in msg::data[]. */ uint32_t sequence; /**< The sequence number is incremented by one for consecutive messages. */ @@ -81,4 +87,4 @@ struct msg float f; /**< Floating point values. */ uint32_t i; /**< Integer values. */ } data[]; -} __attribute__((packed)); \ No newline at end of file +} __attribute__((packed));