好的,我试着用一个简化的例子来解释
#include <stdio.h>
/* Just for print in binary mode */
char *chartobin(unsigned char c)
{
static char a[9];
int i;
for (i = 0; i < 8; i++)
a[7 - i] = (c & (1 << i)) == (1 << i) ? '1' : '0';
a[8] = '\0';
return a;
}
int main(void)
{
unsigned char u = 0xf;
printf("%s\n", chartobin(u));
u >>= 2; // Shift bits 2 positions (to the right)
printf("%s\n", chartobin(u));
printf("%s\n", chartobin(u & 0x1)); // Check if the last bit is on
return 0;
}
输出:
00001111
00000011
00000001
我用 替换上面的行#define AR5K_EEPROM_FF_DIS(_v) 1
吗?
不!
如果你初始化u
而0xb
不是0xf
你得到:
00001011
00000010
00000000
如你看到的(((_v) >> 2) & 0x1 != 1