参考链接:

http://www.runoob.com/csharp/csharp-operators.html

 

表:

[C#]位运算符

 

简单来说,就是:

&:全1为1,否则为0

|:有1为1,否则为0

^:不同为1,否则为0

 

测试:

 1 using UnityEngine;
 2 
 3 public class NewBehaviourScript : MonoBehaviour
 4 {
 5     void Start()
 6     {
 7         print(2 & 1);//0
 8         print(2 | 1);//3
 9         print(2 ^ 1);//3
10     }
11 }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-11-30
  • 2021-11-27
猜你喜欢
  • 2021-12-31
  • 2021-07-25
  • 2021-06-29
  • 2021-10-10
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案