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

1.1     ! root        1: //////////
        !             2: / libc/string/i386/strspn.s
        !             3: / i386 C string library.
        !             4: / ANSI 4.11.5.6.
        !             5: //////////
        !             6: 
        !             7: //////////
        !             8: / size_t
        !             9: / strspn(char *String1, char *String2)
        !            10: /
        !            11: / Return the length of the initial segment of String1
        !            12: / which consists of characters in String2.
        !            13: //////////
        !            14: 
        !            15: String1        .equ    12
        !            16: String2        .equ    String1+4
        !            17: 
        !            18:        .globl  strspn
        !            19: 
        !            20: strspn:
        !            21:        push    %esi
        !            22:        push    %edi
        !            23: 
        !            24:        movl    %edi, String1(%esp)     / String1 address to EDI
        !            25:        movl    %edx, %edi              / and save for length calculation
        !            26:        cld
        !            27: 
        !            28: ?fetch1:
        !            29:        movb    %ah, (%edi)             / String1 character to AH
        !            30:        orb     %ah, %ah
        !            31:        jz      ?done                   / End of String1, done
        !            32:        movl    %esi, String2(%esp)     / String2 address to ESI
        !            33: 
        !            34: ?fetch2:
        !            35:        lodsb                           / String2 character to AL
        !            36:        orb     %al, %al                / If at end of String2, then
        !            37:        jz      ?done                   / String1 char is not in String2, done
        !            38:        cmpb    %ah, %al
        !            39:        jnz     ?fetch2                 / No match, try next char in String2
        !            40:        incl    %edi                    / Match, try next char in String1
        !            41:        jmp     ?fetch1
        !            42: 
        !            43: ?done:
        !            44:        movl    %eax, %edi
        !            45:        subl    %eax, %edx              / Return &last - &String1
        !            46: 
        !            47:        pop     %edi
        !            48:        pop     %esi
        !            49:        ret
        !            50: 
        !            51: / end of libc/string/i386/strspn.s

unix.superglobalmegacorp.com

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