There&#x27;s no memory-to-memory XOR in x86. A XOR swap will need one register, the array address itself will take another, and the &quot;single integer variable&quot; one more. Then you also need the absolute value of the variable; there&#x27;s another register.<p>The single-expression abs that you specify needs at least two registers, one to hold the shifted value and one to hold the original one. Two alternatives which do not involve multiplication and are 3 instructions is here:<p><a href="https:&#x2F;&#x2F;www.strchr.com&#x2F;optimized_abs_function" rel="nofollow">https:&#x2F;&#x2F;www.strchr.com&#x2F;optimized_abs_function</a>