July 2002
Intermediate to advanced
320 pages
8h 15m
English
The three-valued compare function, a slight generalization of the sign function, is defined by

There are both signed and unsigned versions, and unless otherwise specified, this section applies to both.
Comparison predicate instructions permit a three-instruction solution, an obvious generalization of Equations (3):
![]()
A solution for unsigned integers on PowerPC is shown below [CWG]. On this machine, “carry” is “not borrow.”
subf R5,Ry,Rx # R5 <-- Rx - Ry. subfc R6,Rx,Ry # R6 <-- Ry - Rx, set carry. subfe R7,Ry,Rx ...
Read now
Unlock full access