// Swap references a and b without a temporary
// It works on the principle that if you xor
// with something twice you
// get back to where you started.
// Note, this is slower than using a swap temp variable.
int a = 17;
int b = 42;
a = a ^ b;
b = a ^ b; // a ^ b ^ b = a
a = a ^ b; // a ^ b ^ a ^ b ^ b = b