Metropoli BBS
VIEWER: min3.asm MODE: TEXT (ASCII)
;******************************************************************************
; Filename: MIN3.ASM
;   Author: Peter Andersson
;  Version: 0.0
;  Created: 1994.09.17
;  Updated: 1995.03.10
;******************************************************************************
; Copyright Peter Andersson, 1994-1995.
; All rights reserved.
;******************************************************************************
; Function: ULONG @max3(ULONG a,ULONG b,ULONG c)
;  Comment: Returns the smallest of three values
;    Input: Eax - value a
;           Edx - value b
;           Ecx - value c
;  Returns: if (a<b) return (a<c)?a:c; else return (b<c)?b:c
;******************************************************************************

        Include STDDEF.INC

        Codeseg

Proc    min3 ,3
                Pop     Ebx
                Cmp     Eax,Edx
                Sbb     Ebx,Ebx
                And     Eax,Ebx
                Not     Ebx
                And     Edx,Ebx
                Or      Eax,Edx
                Cmp     Eax,Ecx
                Sbb     Ebx,Ebx
                And     Eax,Ebx
                Not     Ebx
                And     Ecx,Ebx
                Or      Eax,Ecx
                Pop     Ebx
                Ret
Endp

        End

[ RETURN TO DIRECTORY ]