Mail Archives: djgpp/1998/04/15/12:16:48
Sérgio Vale e Pace wrote:
> I'm trying to make a struct to work something like this:
>
> defined_struct data;
> data=8;
> data.bit0=1; // data=9
> data.bit2=1; //data=13
>
> or at least
>
> defined_struct data;
> data.value=8;
> data.bit0=1; // data=9
> data.bit2=1; //data=13
>
> but I'm not figuring how can somebody give-me some help.
Use bitfields:
struct S {
unsigned bit0 : 1;
unsigned bit1 : 1;
unsigned bit2 : 1;
unsigned bit3 : 1;
unsigned bit4 : 1;
...
};
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm:+37.20.07/-121.53.38
\
"All the people in my neighborhood / look and get mad and sing"
/ Public Enemy
- Raw text -