标签:bitmap
#include <stdio.h> #define set_bit1(x,y) (x|=(0x01L<<y)) #define set_bit0(x,y) (x&=(~(0x01L<<y))) #define get_bit(x,y) (x&(0x01L<<y)) int main() { int pos = 31; unsigned long bitmap = 0xffffffffffffffffL; set_bit0(bitmap, pos); printf("set0:%lu,get:%d\n", bitmap, get_bit(bitmap, pos)!=0?1:0); set_bit1(bitmap, pos); printf("set1:%lu,get:%d\n", bitmap, get_bit(bitmap, pos)!=0?1:0); return 0; }
标签:bitmap
原文地址:http://blog.csdn.net/lotus302/article/details/43154293