@nuclearcat, you have a problem in your code,
I think the 3rd line:
array[i] ^= array[length-1-i];
Is a mistake, and it's the same then the 1st one.
It's f*** crazy though, bitwise XOR can actually reverse the array :)
I did it with a paper and a pen, and it works! Took me 1/2 hour to understand.