Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bit manipulation 如何获取一组位中的所有位,而不是另一组位_Bit Manipulation_Bitwise Operators - Fatal编程技术网

Bit manipulation 如何获取一组位中的所有位,而不是另一组位

Bit manipulation 如何获取一组位中的所有位,而不是另一组位,bit-manipulation,bitwise-operators,Bit Manipulation,Bitwise Operators,假设我有两组比特。假设它们是两组权限 想要的许可 实际权限 我想知道实际权限中未设置的所需权限 是否有一种只使用位运算符的方法 XOR将给出其中一个中的内容,而不是另一个中的内容,但这并不能告诉我实际权限中未设置的所需权限。您是指所需的&~actual?我认为您是正确的。刚刚用钢笔和纸做了测试。非常感谢。你是说想要的和实际的吗?我想你是对的。刚刚用钢笔和纸做了测试。非常感谢。

假设我有两组比特。假设它们是两组权限

  • 想要的许可
  • 实际权限
我想知道实际权限中未设置的所需权限

是否有一种只使用位运算符的方法


XOR将给出其中一个中的内容,而不是另一个中的内容,但这并不能告诉我实际权限中未设置的所需权限。

您是指
所需的&~actual
?我认为您是正确的。刚刚用钢笔和纸做了测试。非常感谢。你是说想要的和实际的吗?我想你是对的。刚刚用钢笔和纸做了测试。非常感谢。