.TITLE MTH_QUAD_CMP Quadword integer comparison routine .IDENT /V03.01/ ;++MTHQCMP.MAR ; ; FACILITY: ; Quadword integer Mathematics subroutines. ; ; ABSTRACT: ; This module contains the routine to compare two quadword integers. ; ; ENVIRONMENT: ; Called from high-level language (FORTRAN or PASCAL) programs. ; User mode. ; ;-- ; ; MODIFICATION HISTORY: ; ; Gotten from Fall 1980 DECUS VAX/VMS SIG tape. ; ; V01.02 21-Aug-81 FJN Commented and names changed. Added QUAD_EMUL. ; V02.00 08-Jun-82 FJN Names changed yet again. ; V03.00 03-Oct-82 FJN Split package into separate modules ; V03.01 15-Apr-83 FJN Standardize help comments ; ; Copyright (C) 1979 ; Management Science Associates, Inc. ; 5100 Centre Avenue ; Pittsburgh, Pennsylvania 15232 ; ; This software is distributed without cost, and may be ; reproduced only with the inclusion of this copyright ; statement. Management Science Associates assumes no ; responsibility for the performance of this software. ; ; ; EQUATED SYMBOLS: ; LOW = 0 ;Offset to low-order longword HIGH = 4 ;Offset to high-ordr longword ; ; Argument offsets ; QUAD1 = 4 ;Offset to address of first quadword QUAD2 = 8 ;offset to address of second quadword ; ; Program section for code ; .PSECT _MTH_CODE,PIC,USR,CON,REL,LCL,SHR,EXE,NOWRT,RD .SHOW BINARY .PAGE .SBTTL MTH_QUAD_CMP Compare two quadword integers ;+ MTH_QUAD_CMP ; Compare two quadword integers. ; ; cmp.wl.v = MTH_QUAD_CMP( quad1.rq.r, quad2.rq.r ) ; ; quad1 first quadword integer. Passed by reference. ; ; quad2 second quadword integer. Passed by reference. ; ; cmp (longword) result of the quadword comparison: ; -1 if quad1 < quad2 ; 0 if quad1 = quad2 ; +1 if quad1 > quad2 ; Passed by value. ;- ;+0MTH_QUAD_CMP ; ; FUNCTIONAL DESCRIPTION: ; Compare two quadword integers. ; ; CALLING SEQUENCE: ; compare = MTH_QUAD_CMP(quad1,quad2) ; ; INPUT PARAMETERS: ; quad1(AP) address of the first quadword ; quad2(AP) address of the second quadword ; ; OUTPUT PARAMETERS: ; R0 (compare) longword returned as function value is the status ; of the comparison: ; -1 if quad1 < quad2 ; 0 if quad1 = quad2 ; +1 if quad1 > quad2 ; ;- .ENTRY MTH_QUAD_CMP ^M<> MOVAL @QUAD1(AP),R0 ;address of quad1 MOVAL @QUAD2(AP),R1 ;address of quad2 CMPL HIGH(R0),HIGH(R1) ;compare high parts first BLSS 10$ ;xfer for -1 BGTR 30$ ;xfer for +1 CMPL LOW(R0),LOW(R1) ;compare low parts since high same BLSSU 10$ ;xfer for -1 BGTRU 30$ ;xfer for +1 CLRL R0 ;same - return 0 RET ; 10$: CVTBL #-1,R0 ;first less - return -1 RET ; 30$: MOVZBL #1,R0 ;first greater - return +1 RET .END