^ =是什么意思在c / c++吗?

时间:2023-01-18 16:55:23

I have following line of code:

我有以下一行代码:

contents[pos++] ^= key[shift++];

What does operator ^= mean?

运营商^ =是什么意思?

4 个解决方案

#1


17  

It is the XOR assignment operator. Basically:

它是XOR赋值操作符。基本上:

x ^= y;

is the same as:

是一样的:

x = x ^ y;

#2


9  

This means preform an XOR operation on contents[pos++] using key[shift++] and set contents[pos++] equal to the result.

这意味着使用key[shift++]对内容进行XOR操作,并设置内容[pos++]等于结果。

Example:

例子:

contents[pos++]     00010101
key[shift++]        10010001
                    --------
                    10000100

#3


1  

It is a bitwise XOR operator.

它是位XOR运算符。

x ^= y

is basically

基本上是

x = x ^ y

of course, this is a bitwise operation

当然,这是一个位操作

http://en.wikipedia.org/wiki/Bitwise_operation

http://en.wikipedia.org/wiki/Bitwise_operation

#4


0  

It is a bitwise exclusive OR on two integers. http://bytes.com/topic/c/answers/726626-what-caret-qualifier

它是位独占的,或者是两个整数。http://bytes.com/topic/c/answers/726626-what-caret-qualifier

#1


17  

It is the XOR assignment operator. Basically:

它是XOR赋值操作符。基本上:

x ^= y;

is the same as:

是一样的:

x = x ^ y;

#2


9  

This means preform an XOR operation on contents[pos++] using key[shift++] and set contents[pos++] equal to the result.

这意味着使用key[shift++]对内容进行XOR操作,并设置内容[pos++]等于结果。

Example:

例子:

contents[pos++]     00010101
key[shift++]        10010001
                    --------
                    10000100

#3


1  

It is a bitwise XOR operator.

它是位XOR运算符。

x ^= y

is basically

基本上是

x = x ^ y

of course, this is a bitwise operation

当然,这是一个位操作

http://en.wikipedia.org/wiki/Bitwise_operation

http://en.wikipedia.org/wiki/Bitwise_operation

#4


0  

It is a bitwise exclusive OR on two integers. http://bytes.com/topic/c/answers/726626-what-caret-qualifier

它是位独占的,或者是两个整数。http://bytes.com/topic/c/answers/726626-what-caret-qualifier