I have a bit field struct as below
but there are only 26 bit fields and it is a size of 32 bits, I am wondering will there be any problem?Code:
typedef struct
{
uint32_t bB0:1;
uint32_t bB1:1;
uint32_t bB2:1;
uint32_t bB3:1;
uint32_t bB4:1;
uint32_t bB5:1;
uint32_t bB6:1;
uint32_t bB7:1;
uint32_t bB8:1;
uint32_t bB9:1;
uint32_t bB10:1;
uint32_t bB11:1;
uint32_t bB12:1;
uint32_t bB13:1;
uint32_t bB14:1;
uint32_t bB15:1;
uint32_t bB16:1;
uint32_t bB17:1;
uint32_t bB18:1;
uint32_t bB19:1;
uint32_t bB20:1;
uint32_t bB21:1;
uint32_t bB22:1;
uint32_t bB23:1;
uint32_t bB24:1;
uint32_t bB25:1;
uint32_t bB26:1;
}channels;
Is there a faster way of assigning values to the bit fields? other than channels.bB1 = 1 and so on and so forth?