Hello I have a build with a lot of structures in a big-endian style layout. [I recognise that bit-fields are not portable due to their ordering not being locally MSB first like the regular bit shift operation << is. i.e. (1<<2) == 4 ]
typedef struct reg32 { union { _uint32 REG32; struct { _uint32 BIT31:1; _uint32 BIT30:1; _uint32 BITS:30; } B; } R; } reg32_t; On a little-endian ARM build. Using : arm-none-eabi-gcc (Sourcery G++ Lite 2010.09-51) 4.5.1 Writing reg.R.REG32 = 1, results in BIT31 containing 1. Rather than the "1" being in the "BITS" field. My thought is I'll need to swap every structure to be in little-endian style ordering. Does anyone have any other ideas how to handle this with gcc? I was thinking to write a little program to make the changes to the header file. Please include my email address in any replies. Best regards, Jon