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

1.1     ! root        1: //////////
        !             2: / libc/string/i386/strcspn.s
        !             3: / i386 C string library.
        !             4: / ANSI 4.11.5.3.
        !             5: //////////
        !             6: 
        !             7: //////////
        !             8: / size_t
        !             9: / strcspn(char *String1, char *String2)
        !            10: /
        !            11: / Return the length of the initial segment of String1
        !            12: / which consists of characters ->not<- in String2.
        !            13: //////////
        !            14: 
        !            15: String1        .equ    12
        !            16: String2        .equ    String1+4
        !            17: 
        !            18:        .globl  strcspn
        !            19: 
        !            20: strcspn:
        !            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:        incl    %edi
        !            31:        orb     %ah, %ah
        !            32:        jz      ?done                   / End of String1, done
        !            33:        movl    %esi, String2(%esp)     / String2 address to ESI
        !            34: 
        !            35: ?fetch2:
        !            36:        lodsb                           / String2 character to AL
        !            37:        orb     %al, %al
        !            38:        jz      ?fetch1                 / Done with String2, fetch next from String1
        !            39:        cmpb    %ah, %al
        !            40:        jne     ?fetch2                 / Mismatched, try next in String2
        !            41: 
        !            42: ?done:
        !            43:        decl    %edi                    / Back up to last String1 char
        !            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/strcspn.s

unix.superglobalmegacorp.com

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