1.设置
#define SetBit(A,k) ( A[(k/32)] |= (1 << (k%32)) )
2.清除
#define ClearBit(A,k) ( A[(k/32)] &= ~(1 << (k%32)) )
3.测试
#define TestBit(A,k) ( A[(k/32)] & (1 << (k%32)) )
参考:
http://www.mathcs.emory.edu/~cheung/Courses/255/Syllabus/1-C-intro/bit-array.html
https://stackoverflow.com/questions/4201301/warning-left-shift-count-width-of-type
https://en.wikipedia.org/wiki/Bit_array