Annotation of coherent/b/lib/libc/string/i386/streq.s, revision 1.1

1.1     ! root        1: //////////
        !             2: / libc/string/i386/streq.s
        !             3: / i386 C string library.
        !             4: / Not in ANSI C standard.
        !             5: //////////
        !             6: 
        !             7: //////////
        !             8: / int
        !             9: / streq(char *String1, char *String2)
        !            10: /
        !            11: / Compare String1 and String2 for equality, return 1 or 0.
        !            12: //////////
        !            13: 
        !            14: String1        .equ    12
        !            15: String2        .equ    String1+4
        !            16: 
        !            17:        .globl  streq
        !            18: 
        !            19: streq:
        !            20:        push    %esi
        !            21:        push    %edi
        !            22: 
        !            23:        movl    %esi, String2(%esp)     / String2 address to ESI
        !            24:        movl    %edi, String1(%esp)     / String1 address to EDI
        !            25:        subl    %ecx, %ecx              / Result to ECX
        !            26:        cld
        !            27: 
        !            28: ?loop:
        !            29:        lodsb                           / String2 character to AL
        !            30:        scasb                           / Compare to String1 character
        !            31:        jne     ?done                   / Mismatch, return 0
        !            32:        orb     %al, %al
        !            33:        jne     ?loop                   / Not done yet
        !            34:        incl    %ecx                    / Matched, return 1
        !            35: 
        !            36: ?done:
        !            37:        movl    %eax, %ecx              / Result to EAX
        !            38: 
        !            39:        pop     %edi
        !            40:        pop     %esi
        !            41:        ret
        !            42: 
        !            43: / end of libc/string/i386/streq.s

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.