Is there a Swap faster than using XOR!!!

From: ANaiveProgrammer (myhotline_at_gmail.com)
Date: 11/29/04


Date: 28 Nov 2004 16:10:18 -0800

hi all

swapping two variables using xor can be as follows
b = a ^ b
a = b ^ a
b = a ^ b
i've been given an assigment to do a swap faster than above and
without using three variables ( on a linux box over i80x86)? I was
wondering howz that possible? Any help will be highly
appreciated......
regards
waqas



Relevant Pages

  • Re: Is there a Swap faster than using XOR!!!
    ... >> swapping two variables using xor can be as follows ... >> i've been given an assigment to do a swap faster than above and ... > The XOR trick is old and tired. ... > Anyone giving you an assignment to do a swap with a temporary variable ...
    (comp.lang.c)
  • Re: Is there a Swap faster than using XOR!!!
    ... myhotline@gmail.com (ANaiveProgrammer) wrote: ... > swapping two variables using xor can be as follows ... If whoever gave you that assignment doesn't agree, ...
    (comp.lang.c)
  • Re: Is there a Swap faster than using XOR!!!
    ... > swapping two variables using xor can be as follows ... > i've been given an assigment to do a swap faster than above and ... The XOR trick is old and tired. ...
    (comp.lang.c)