Swap two variables using XOR

Most people would swap two variables x and y using a temporary variable, like this:

tmp = x
x = y
y = tmp

Here’s a neat programming trick to swap two values without needing a temp:

x = x &hellip; <a href="http://betterexplained.com/articles/swap-two-variables-using-xor/" class="read_more">Read article</a>