;[]-----------------------------------------------------------------[]
;|      N_PCMP.ASM -- long pointer comparison                        |
;[]-----------------------------------------------------------------[]

;
;       C/C++ Run Time Library - Version 6.0
; 
;       Copyright (c) 1987, 1993 by Borland International
;       All Rights Reserved.
; 

        INCLUDE RULES.ASI

; calls to this routine are generated by the compiler to compare
; long pointers.

_TEXT   SEGMENT BYTE PUBLIC 'CODE'
        ASSUME  CS:_TEXT
;
;       PCMP@ - compares two pointers, sets the condition codes
;
;       ax,dx   left hand pointer
;       bx,cx   right hand pointer

        public  N_PCMP@

N_PCMP@         PROC    NEAR
                push    cx
                mov     ch,al
                mov     cl,4
                shr     ax,cl
                add     dx,ax
                mov     al,ch
                mov     ah,bl
                shr     bx,cl
                pop     cx
                add     cx,bx           ; right hand pointer segment
                mov     bl,ah
                and     ax,0fh
                and     bx,0fh
                cmp     dx,cx           ; compare segments
                jne     PCMPend
                cmp     ax,bx           ; compare offsets
PCMPend:
                ret
N_PCMP@         ENDP
_TEXT   ENDS
        END
