Condense common xor code.