标签:blog os io 2014 amp log file ef
第3位的置位与清除操作。
#include <stdio.h> #include <stdlib.h> #include <string.h> #define BIT3 (0x1<<3) int main() { int a = 0x00000000; printf("a = 0x%08X\n", a); /* 置位第3bit a = a | (0x1<<3) a = a | 0x8 */ a |= BIT3; printf("a = 0x%08X\n", a); /* 清楚第3bit a = a & ~ (0x1<<3) a = a & ~ 0x8 a = a & 0xfffffff7 */ a &= ~BIT3;// printf("a = 0x%08X\n", a); } /* [root@localhost test_class]# gcc quote.cpp ;./a.out a = 0x00000000 a = 0x00000008 a = 0x00000000 */
寄存器中 置位 与 清除 -- C,布布扣,bubuko.com
标签:blog os io 2014 amp log file ef
原文地址:http://blog.csdn.net/cy_cai/article/details/38316251