一、指定的某一位数置1

 #define setbit(x,y)  x|=(1<<y)

二、指定的某一位数置0

#define clrbit(x,y)  x&=~(1<<y)

三、指定的某一位数取反

#define reversebit(x,y)  x^=(1<<y)

三、获取的某一位的值

#define getbit(x,y)   ((x) >> (y)&1)

相关文章:

  • 2021-12-30
  • 2022-12-23
  • 2021-07-08
  • 2021-12-03
猜你喜欢
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2022-01-22
  • 2021-11-20
相关资源
相似解决方案