There was a message a while back about not being able to create a good #define function to swap two variables. How about this one: #define swap(a,b) a^=b^=a^=b