I replaced the values โโof two integers with XOR-swap, and for this I used the following line of code:
a ^= (b ^= (a ^= b));
Then b gets the correct value (the old value of a ), but a becomes zero. If I do not write it on one line, it works fine, for example:
a ^= b; b ^= a; a ^= b;
Am I doing something wrong, or are netbeans / compiler / JRE doing something wrong? (using netbeans 7.2.1)
source share