Near Matches
Ignore Exact
Everything
2
how to exchange two variables without using a third (idea)
See all of How to exchange two variables without using a third
, there are 5 more in this node.
See also:
XOR swap
(
idea
)
by
AlephNot
Wed Aug 22 2001 at 0:17:28
Don't forget the following line in C:
a ^= b ^= a ^= b;
It may not be obvious but, assuming a and b are integers, this single line swaps the values in a and b. It takes advantage of the fact that, given x XOR y = z, you can determine any of x, y, or z, given the other two. Pretty nifty, if you ask me.
-----
Ok, I just now noticed the "xor swap" node has this exact idea already there. I swear I DID NOT see it there until after I posted this writeup, but if you don't believe me, I'll understand.
TMTOWTDI
machine epsilon
Female restroom etiquette
XOR swap
Impossible Nintendo Cartridges
Why I got my tattoo
Any sufficiently nice person is indistinguishable from someone who likes you
How to exchange two variables by using a third
When I have female children
catastrophic cancellation
XOR
Experiences With Shaving
Why?
Young Virgin Auto-Sodomized by Her Own Chastity
polymorphic virus
Perl
String Theory
How I plan to use Spain
Starbucks and Starbucks
The Book of Who Cares
Søren Kierkegaard