Although x could overflow in this case, where it wouldn't with an xor, right?

Leonid Grinberg wrote:
not in-place cause it's 3 lines, but does not use an external temporay
value, and should be language-independent:
  x = x + y
  y = x - y
  x = x - y
(IIRC my high school BASIC teacher taught us that)

Yeah, that works. Who said that it can't be 3 lines.

Reply via email to