COMPAR(III)                  1/15/73                  COMPAR(III)







NAME

     compar - default comparison routine for qsort



SYNOPSIS

     jsr     pc,compar



DESCRIPTION

     Compar is the default comparison routine called by qsort and

     is  separated  out  so  that  the  user  can  supply his own

     comparison.



     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.



     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



             cmpb    (r0),(r4)



     suffices.



     Only r0 is changed by the call.



SEE ALSO

     qsort (III)



BUGS

     It could be recoded to run faster.