, _ /| | | _/_\_ >_< .-\-/. | / | | \_ | \ \| |\__(/ /(`---') | / / \ | _.' \'-' / | `----'`=-=' ' hjw C Thaumaturgy Center You like magic? Swapping values with XOR #define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) This is an old trick to exchange the values of the variables a and b without using extra space for a temporary variable. On January 20, 2005, Iain A. Fleming pointed out that the macro above doesn't work when you swap with the same memory location, such as SWAP(a[i], a[j]) with i == j. So if that may occur, consider defining the macro as (((a) == (b)) || (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))). On July 14, 2009, Hallvard Furuseth suggested that on some machines, (((a) ^ (b)) && ((b) ^= (a) ^= (b), (a) ^= (b))) might be faster, since the (a) ^ (b) expression is reused. TEXT Get the full database. HTML Got some C magic? Send the spell source to 20h@r-36.net TEXT Problems reading C? DIR << back to bitreich.org