#include
unsigned char read_bit_fun(unsigned char name,int begin,int num);
int main()
{
unsigned char c;
c=read_bit_fun(0xff,0,8);
printf("%d\n",c);
return 0;
}
/*取位值函数定义*/
unsigned char read_bit_fun(unsigned char name,int begin,int num)
{
//0 1 2 3 4 5 6 7 8
unsigned char value[]={0x01,0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff};
unsigned char bit;
bit=(name>>begin)&(value[num]);
//printf("bit=%x\n",(name>>begin)&(value[num]));
return bit;
}
阅读(2344) | 评论(0) | 转发(0) |