Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Marshall Brown
12/29/05 01:14
Read: 778 times
New Zealand

#106143 - Swapping 2 variables without a temp.
Found this on the web and thought it might be good for the For the "wow that's a cool idea file"

For swapping 2 variables with no temporary variable, no doubt just as easy to implement in asm once you have thought of the idea.

one ^= two;
two ^= one;
one ^= two;

due credit to whoever wrote it


List of 8 messages in thread
Swapping 2 variables without a temp.      Marshall Brown      12/29/05 01:14      
   Does it help ?      Steve M. Taylor      12/29/05 04:33      
   what aboyt SWAP, it is ONE instruction      Erik Malund      12/29/05 06:48      
      I think you meant XCH      Hal Albach      12/29/05 07:50      
         I did, stupid me      Erik Malund      12/29/05 08:35      
            Sorry      Marshall Brown      12/29/05 13:02      
               Pointers      Andy Neil      12/29/05 13:22      
                  Call me      Steve M. Taylor      12/29/05 14:02      

Back to Subject List