What is this....

Without getting in to too much detail.... I'm deconstructing a bit of code in an effort to write my own program to do a similar function and there's something in here I don't recognize....

^=

Specifically....

var1 ^= var2

Any ideas or anybody that knows? Any information would be helpful. I've been able to read all of the code and understand it myself with the exception of this one thing. Unfortunately, the great Google gods came up empty today.

^ is the exclusive-OR operator. ^= does an XOR with the two operands and saves the result in the one on the left.

MorganS:
^ is the exclusive-OR operator. ^= does an XOR with the two operands and saves the result in the one on the left.

& - Arduino Reference

Ah ha! That makes perfect sense as related to what I'm looking at. I knew ^ was XOR, but it wasn't making sense to me as related to =. Thanks for the help!

See http://www.cplusplus.com/doc/tutorial/operators/

The ^= is mentioned in the section "compound assignment"

It's also on page 119 of the C++ specification document http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf

It's the short form for

var1 = var1 ^ var2;