carlos m wrote:
> Hey Reid,
> 
> Don't think there is a built-in function that will do that for
> you--not that I am aware of anyway--but there is definitely a way of
> implementing it! Check out this blog post by the awesome guys at
> polygonal:
> http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/ .
> Specifically, check out the section labeled "Swap integers without
> temporary variables using XOR."
> 
> Lot's of goodies on that blog!
> 
>  Cliffnotes: 
 > var t:int = a;
 > a = b;
 > b = t;
> 
> //equals: 
 > a ^= b;
 > b ^= a;
 > a ^= b;HTH!

Hi Carlos,

Thanks for the note -- I suppose I should have been more clear. I meant, 
how to swap two variables in one line: it's not about speed but rather 
clarity. :)

Reid


Reply via email to