.TITLE LIB_CMPQ ;++ ; Author: John W. Manly Creation Date: Fall, 1986 ; ; Functional description: ; Compares 2 quadwords ; ; Calling sequence: ; result.wl.v := LIB_CMPQ( oper1.rq.r, ; oper2.rq.r) ; ; Formal arguments: ; oper1 ; VMS Usage : quadword_unsigned ; type : quadword (unsigned) ; access : read only ; mechanism : by reference ; ; Address of a quadword. ; ; oper2 ; VMS Usage : quadword_unsigned ; type : quadword (unsigned) ; access : read only ; mechanism : by reference ; ; Address of another quadword to compare to the first. ; ; Implicit inputs: ; none ; ; Implicit outputs: ; none ; ; Routine value: ; -1 if OPER1 < OPER2 ; 0 if OPER1 = OPER2 ; 1 if OPER1 > OPER2 ; ; Side effects: ; none ;-- ; Argument list offsets: oper1 = 4 oper2 = 8 .PSECT _LIB_CMPQ,EXE,NOWRT,LONG .ENTRY LIB_CMPQ,^M MOVAB @oper1(AP), R1 ; Get the address of the first operand MOVAB @oper2(AP), R2 ; Get the address of the second operand MNEGL #1, R0 ; set the result to -1 CMPL 4(R1), 4(R2) ; Compare the most significant longwords BLSS 3$ ; If oper1 < oper2, return -1 BGTR 1$ ; If oper1 > oper2, return 1 CMPL (R1), (R2) ; Compare the least significant longword BEQL 2$ ; If oper1 = oper2, return 0 BLSSU 3$ ; If oper1 < oper2, return -1 1$: INCL R0 ; Set return from -1 to 0 2$: INCL R0 ; Set return from 0 to 1 3$: RET .END