OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [machine/] [rx/] [strlen.S] - Rev 345

Compare with Previous | Blame | View Log

        .file   "strlen.S"

        .section .text
        
        .global  _strlen
        .type    _strlen,@function
_strlen:
        add     #0, r1, r4      ; Save a copy of the string start address and set the condition flags.
        beq     null_string     ; Test for a NULL pointer.
        mov     #-1, r3         ; Set a limit on the number of bytes examined.
        mov     #0,  r2         ; Stop searching when we find a NUL byte.
        suntil.b                ; Search until *r1 == r2
        sub     #1, r1          ; suntil.b leaves r1 pointing to the byte beyond the match.
null_string:
        sub     r4, r1          ; Compute the length.
        rts

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.