V4/man/man3/compar.3

Compare this file to the similar file:
Show the results in this format:

.th COMPAR III 1/15/73
.sh NAME
compar \*- default comparison routine for qsort
.sh SYNOPSIS
.ft B
jsr	pc,compar
.ft R
.sh DESCRIPTION
.it Compar
is the default comparison routine
called by \fIqsort\fR and is separated out so that the user can
supply his own comparison.
.s3
The routine is called with the width (in bytes) of
an element in r3 and it compares byte-by-byte the element
pointed to by r0 with the element pointed to by r4.
.s3
Return is via the condition codes,
which are tested by the instructions ``blt'' and ``bgt''.
That is, in the absence of overflow, the 
condition (r0) < (r4) should leave the Z-bit off and N-bit
on while (r0) > (r4) should leave Z and N off.
Still another way of putting it is that for elements
of length 1 the instruction
.s3
	cmpb	(r0),(r4)
.s3
suffices.
.s3
Only r0 is changed by the call.
.sh "SEE ALSO"
qsort (III)
.sh BUGS
It could be recoded to run faster.