July 2002
Intermediate to advanced
320 pages
8h 15m
English
A very old trick is that of exchanging the contents of two registers without using a third [IBM]:

This works well on a two-address machine. The trick also works if ⊕ is replaced by the ≡ logical operation (complement of exclusive or), and can be made to work in various ways with add’s and subtract’s:

Unfortunately, each of these has an instruction that is unsuitable for a two-address machine, unless the machine has “reverse subtract.”
This little trick can actually be useful in the application of double buffering, ...
Read now
Unlock full access