I am doing some embedded software on a 32 bits architecture (precisely AVR32). On this software I am retrieving a flag, coded on one byte, from an external peripheral connected via I2C.
Each bits of this byte are a boolean variable. The struct is the following:
typedef union __attribute__((packed)){
struct __attribute__((packed)) {
uint8_t flag_a : 1;
uint8_t flag_b : 1;
uint8_t flag_c : 1;
uint8_t flag_d : 1;
uint8_t flag_e : 1;
uint8_t __unused : 3;
}
uint8_t raw;
}Flag_t;
My question is, if I want to make this code portable, do I need to redefine the struct inside the union in the reverse order for the other endianness ?
Or, is the endianness issues not present in this situation ?