Skip to content

Instantly share code, notes, and snippets.

@hhyyy9
Created December 6, 2012 14:39
Show Gist options
  • Select an option

  • Save hhyyy9/4224875 to your computer and use it in GitHub Desktop.

Select an option

Save hhyyy9/4224875 to your computer and use it in GitHub Desktop.
位定义
typedef struct bitS
{
unsigned bit0:1;
unsigned bit1:1;
unsigned bit2:1;
unsigned bit3:1;
unsigned bit4:1;
unsigned bit5:1;
unsigned bit6:1;
unsigned bit7:1;
}pbitS;
typedef union byteB
{
struct bitS b;
unsigned char c;
}uByteB;
使用的地方:
union byteB a;
a.b.bit0=1;
a.b.bit3=1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment