Given two variables x and y, the typical way to swap their values is by means of a third variable t.
t = x; x = y; y = t;
But using a bit-wise exclusive-or operation on integer values, we can swap them without an intermediate variable as follows.
x = x ^ y; y = x ^ y; x = x ^ y;
In C, this can be further shortened to
x ^= y; y ^= x; x ^= y;