everything is clear now!, thanks all for your guides and patience. - Randi On Sat, Aug 29, 2009 at 3:19 AM, Glynn Clements<glynn@xxxxxxxxxxxxxxxxxx> wrote: > > Randi Botse wrote: > >> Ben, after assign all bitfield struct member, how to pack them to be a >> 32bit integer value? > > The structure should be 32 bits wide. If you need the value as a > uint32_t, either use a union: > > union bits_or_int { > struct bitfield fields; > uint32_t value; > }; > > or a cast, e.g.: > > struct bitfield foo; > ... > uint32_t value = *(uint32_t *)&foo; > > -- > Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx> > -- To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html