The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: jdoe on December 10, 2007, 04:13:30 AM

Title: Faster IsEqualGUID
Post by: jdoe on December 10, 2007, 04:13:30 AM
Not really impressive, but this function replaces IsEqualGUID which comes from ole32.dll
Just for the pleasure of making different. The attachment shows the speed enhancement.


OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

ALIGN 16

NOP
NOP

;
; Compares one GUID to another
;
; Returns non-zero if equal
;
; p_lpGUID1 = Pointer to the first GUID
; p_lpGUID2 = Pointer to the second GUID
;
AzmtIsEqualGUID PROC p_lpGUID1:DWORD, p_lpGUID2:DWORD

    mov eax, [esp+4]
    mov ecx, [esp+8]

    mov edx, dword ptr [eax]
    cmp dword ptr [ecx], edx
    jne @F

    mov edx, dword ptr [eax+4]
    cmp dword ptr [ecx+4], edx
    jne @F

    mov edx, dword ptr [eax+8]
    cmp dword ptr [ecx+8], edx
    jne @F

    mov edx, dword ptr [eax+12]
    cmp dword ptr [ecx+12], edx
    jne @F

    ret 8

@@:

    xor eax, eax

    ret 8

AzmtIsEqualGUID ENDP

OPTION PROLOGUE:PROLOGUEDEF
OPTION EPILOGUE:EPILOGUEDEF




[attachment deleted by admin]