Annotation of researchv10no/libc/gen/strlen.s, revision 1.1

1.1     ! root        1:        .file   "strlen.s"
        !             2: #      @(#)strlen.s    1.5
        !             3: # Fast assembler language version of the following C-program
        !             4: #                      strlen
        !             5: # which represents the `standard' for the C-library.
        !             6: 
        !             7: # Given string s, return length (not including the terminating null).
        !             8: 
        !             9: #      strlen(s)
        !            10: #      register char *s;
        !            11: #      {
        !            12: #              register n;
        !            13: #      
        !            14: #              n = 0;
        !            15: #              while (*s++)
        !            16: #                      n++;
        !            17: #              return(n);
        !            18: #      }
        !            19:        .globl  _strlen
        !            20:        .text
        !            21:        .align  2
        !            22: _strlen:
        !            23:        .word   0x0000          # pgm uses regs 0,1,2
        !            24:        movl    4(ap),r2        # ptr to s1
        !            25:        movl    r2,r1           # workin copy in r1
        !            26: L0:
        !            27:        locc    $0,$65535,(r1)  # search for a terminating null
        !            28:        beql    L0              # go back for more if string is BIG!
        !            29:        subl3   r2,r1,r0        # calculate string length in r0
        !            30:        ret

unix.superglobalmegacorp.com

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