4 ms·
This is a very old trick. According to Knuth, it goes back to at least 1961, where it was found in IBM programming course notes in a more general form that incl
by iconjack 14y ago
This is a very old trick. According to Knuth, it goes back to at least 1961, where it was found in IBM programming course notes in a more general form that includes a mask:
x ← x ⊕ y, y ← y ⊕ (x & m), x ← x ⊕ y
The mask determines the subset of bits that get swapped.