Optimized boolean xor