Compute the xor of two 2-bit registers


#1

Puzzles 34 and 43 are asking to compute the exclusive-or (xor) of two bits, shown by the color of the intercepted ball.

Challenge: can you compute the bitwise xor of two 2-bit registers, and have the result shown in a third 2-bit register (which initially shows 00)? (In other words, each bit of register C shows 1 if and only if the corresponding bits of registers A and B are different.) Assume A, B, and C are laid out vertically.

I guess there are a several variants. The registers might be laid out horizontally instead of vertically. Instead of showing the result in a third register C, the result might be shown in the second register. And, of course, there is the generalization to n-bit registers.