News for hackers. Stuff that matters.
Re:Tesla's Simultaneous Brilliance and Incompetence Revealed... by derekp7 on Friday April 27, 2018 @06:11PM (#16944861)
So a good example of this in code would be:

    a = a xor b; b = a xor b; a = a xor b;
In this case it is a technique for swapping two variables without using a third variable. But it really serves no efficiency purpose in most applications (however it is fun to use).
Re:Tesla's Simultaneous Brilliance and Incompetence Revealed... by samatman on Friday April 27, 2018 @06:35PM (#16944978)
Which comes with the obligatory reminder that it fails when a == b.
Re:Tesla's Simultaneous Brilliance and Incompetence Revealed... by twtw on Friday April 27, 2018 @06:46PM (#16945016)
No it doesn't. xor swap works fine when the two values are equal. The problem is when &a == &b.