"i knew that there was a handy little way of switching 2 values using something with XOR without using a 3rd variable. i just couldn't remember it... so i went googling... it sure was faster than going through my books :)) and voila... XOR 2 values bitwise 3 times and they're switched."

After a while the original post was updated with even faster function which makes use of a char array of fixed length so string copy in memory is avoided: