printf("the value is 10000001 !/n");
unsigned char a=129;
int r[8]={0};
r[0] = a & 0x01; // 最低位
r[1] = ( a & 0x02) >> 1;
r[2] = ( a & 0x04) >> 2;
r[3] = ( a & 0x08) >> 3;
r[4] = ( a & 0x10) >> 4;
r[5] = ( a & 0x20) >> 5;
r[6] = ( a & 0x40) >> 6;
r[7] = ( a & 0x80) >> 7;
获取字节的各个bit
最新推荐文章于 2022-08-16 14:38:18 发布