I remember this peice of code... funny thing is this operation uses more lines of assembly code (4 instead of 3 if i remember correctly) and the same number of registers than a simple snippet like this:
int x = 5;
int y = 1;
int temp;
temp = x;
x = y;
y = temp;
So it is less efficient even though you can write it on one line. The code using XOR is also much harder for people to glance at and understand.
So remember kids, writing slick code like this isn't necessarily better.
__________________
Smoke me a kipper, I'll be back for breakfast.
|