XOR optimizations