Statistics

Members: 1927
News: 293
Web Links: 1
Visitors: 3926701

Who's Online

Damn Vulnerable LinuxDamn Vulnerable Linux (DVL) is a Linux-based (modified Damn Small Linux) tool for IT-Security & IT-Anti- Security and Attack & Defense. [CLICK HERE FOR MORE INFOS! ]

Featured Conference Video

T16-Recon2006-Joe_Stewart-OllyBonE.gif OllyBone - Semi-Automatic Unpacking on IA-32. View the conference video here!
Home arrow Articles - Black Hat Methods arrow Assembly arrow Max
Max
User Rating: / 0
PoorBest 
Written by Chris Dragan   


;Summary:       eax = max (eax, ecx) (both eax and ecx unsigned)
;Compatibility: 386+
;Notes:     9 bytes, 5 clocks (P5), destroys ecx and edx
    sub    ecx, eax    ; ecx = n2 - n1
    cmc            ; cf = n1 <= n2
    sbb    edx, edx    ; edx = (n1 > n2) ? 0 : -1
    and    ecx, edx    ; ecx = (n1 > n2) ? 0 : (n2 - n1)
    add    eax, ecx    ; eax += (n1 > n2) ? 0 : (n2 - n1)
; Standard cmp/jae/mov takes 2-8 clocks on P5 and 1-17 on P6