(1)位编程
跳转到“(1)位编程”// 比如想操作3位bit,111 = 2^3-1 = 7int num = 7; // 初始数字7int result = num;// 将其中第2位置0result &= ~(1 << 1);// 将前两位置0result &= ~((1 << 2) - 1);// 将后2位置0
// 将1 , 3位置0result &= ~(1 | (1 << 2));// 比如想操作3位bit,111 = 2^3-1 = 7int num = 7; // 初始数字7int result = num;// 将其中第2位置0result &= ~(1 << 1);// 将前两位置0result &= ~((1 << 2) - 1);// 将后2位置0
// 将1 , 3位置0result &= ~(1 | (1 << 2));