Ruby: What is the fastest way to xor 2 integers in Ruby? : Given an array a of n elements, I should replace a[i] with a[i] XOR a[i+1] for m number of times. The value of m may reach up to 10^18. What is the fastest and best approach?