152720Sbostic/*- 252720Sbostic * Copyright (c) 1991 The Regents of the University of California. 352720Sbostic * All rights reserved. 452720Sbostic * 552720Sbostic * This code is derived from software contributed to Berkeley by 652720Sbostic * Ralph Campbell. 752720Sbostic * 852720Sbostic * %sccs.include.redist.c% 952720Sbostic */ 1052720Sbostic 11*52737Sbostic#include "DEFS.h" 12*52737Sbostic 1352720Sbostic#if defined(LIBC_SCCS) && !defined(lint) 14*52737Sbostic ASMSTR("@(#)strlen.s 5.2 (Berkeley) 02/29/92") 1552720Sbostic#endif /* LIBC_SCCS and not lint */ 1652720Sbostic 1752720SbosticLEAF(strlen) 1852720Sbostic addu v1, a0, 1 1952720Sbostic1: 2052720Sbostic lb v0, 0(a0) # get byte from string 2152720Sbostic addu a0, a0, 1 # increment pointer 2252720Sbostic bne v0, zero, 1b # continue if not end 2352720Sbostic subu v0, a0, v1 # compute length - 1 for '\0' char 2452720Sbostic j ra 2552720SbosticEND(strlen) 26