I need to translate a C struct to C# which uses bit fields.
typedef struct foo
{
unsigned int bar1 : 1;
unsigned int bar2 : 2;
unsigned int bar3 : 3;
unsigned int bar4 : 4;
unsigned int bar5 : 5;
unsigned int bar6 : 6;
unsigned int bar7 : 7;
...
unsigned int bar32 : 32;
} foo;
Anyone knows how to do this please?
BitArray
as suggested by @Nekresh, and perhaps wrap it in properties that get/set bit groups (quite a bit of work, though). – MelissamelisseBitField
class which would be very simple. – Reichstruct
first. – Hurlow