.title treecmpr use with tree subr to compare 2 nodes .sbttl ; ; call treecmpr(p,q,typleng,offset,ord) ; dcl (p,q) ptr ; dcl(typleng,offset,ord) fixed bin(31); ; ord is -1,0,+1 if (p+offset)->key is <,=,> (q+offset)->key ; typeleng = +n => n char key ; 0 longword ; -1 f float ; -2 d float ; ; t dow 10/23/81 ; .psect clm_code pic,usr,con,rel,lcl,shr,exe,rd,nowrt treecmpr:: .word ^m ;cmpc3 instr uses r4,r5 implicitly movl @16(ap),r1 ;offset of key in node addl3 @4(ap),r1,r2 ;addr of left arg addl3 @8(ap),r1,r3 ;addr of right arg movl @12(ap),r1 ;typleng (this sets condition codes) beql int ;typleng=0, integer bgtr char ; >0, character blbc r1,dbl ; -even (-2), dbl float cmpf (r2),(r3) ; -odd, assume single float brb order ; go test condition codes int: cmpl (r2),(r3) ;integer longword brb order dbl: cmpd (r2),(r3) brb order char: cmpc3 r1,(r2),(r3) ;char compare order: beql eq ; keys equal blss lss ; pq, ord=+1 brb ret ; go return eq: clrl @20(ap) ; p=q, ord=0 brb ret lss: movl #-1,@20(ap) ; p