2 ms·
I like to think about this algebraically: a1 = a0 ^ b0 b1 = b0 ^ a1 = b0 ^ (a0 ^ b0) = (a0 ^ b0) ^ b0 = a0 a2 = a1 ^ b1 = (a0 ^ b0) ^ a0 = (b0 ^ a0
by eutectic 10y ago
I like to think about this algebraically:
a1 = a0 ^ b0
b1 = b0 ^ a1 = b0 ^ (a0 ^ b0) = (a0 ^ b0) ^ b0 = a0
a2 = a1 ^ b1 = (a0 ^ b0) ^ a0 = (b0 ^ a0) ^ a0 = b0
The xor-linked list (https://en.wikipedia.org/wiki/XOR_linked_list https://en.wikipedia.org/wiki/XOR_linked_list) is another neat idea along the same theme.