if ( !( a < 0 ) ) { ... } if ( a >= 0 ) { ... }
The two operators
<
and >=
cover all possible integer values.
The set instructions
are used to implement relational operators.
However, they do not in themselves alter
the flow of control.
They set a register to 1 or 0 to show
the relation between two values.
The slt
instruction is used with
two's complement integers:
# $s and $t contain # two's comp. integers # slt d,s,t # if ( $s < $t ) # d <-- 1 # else # d <-- 0
The sltu
instruction is used with
unsigned integers:
# $s and $t contain # unsigned integers # sltu d,s,t # if ( $s < $t ) # d <-- 1 # else # d <-- 0