2010-09-22 41 views

回答

17

插入符号(^)转换为XOR运算符,它是“按位异或”。用普通英语表示“或者,但不是两个”。下面介绍一下它的作用:

的MSDN页面上
decimal 1 = binary 001      decimal 1 = binary 001 
XOR          XOR 
decimal 2 = binary 010      decimal 3 = binary 011 
=           = 
decimal 3 = binary 011      decimal 2 = binary 010 

更多信息的bitwise operations

4
3^2 
    = 
    000011 (3) 
    xor 
    000010 (2) 
    = 
    000001 (1) 
    = 
    1 
+0

我认为你的加号是误导 - 这不是添加,这是XORing数字。你的设置适用于1^2的第一个例子,但在第二个例子中失败1^3 – 2010-09-22 12:36:40

+0

@Dave McClelland感谢评论,我也在想。 – 2010-09-22 12:37:42

+0

我必须在您的第一篇文章和您的修订版之间发布忍者帖。现在看起来不错:) – 2010-09-22 12:41:38