152720Sbostic/*- 2*61146Sbostic * Copyright (c) 1991, 1993 3*61146Sbostic * The Regents of the University of California. 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 1155708Sralph#include <machine/machAsmDefs.h> 1252737Sbostic 1352720Sbostic#if defined(LIBC_SCCS) && !defined(lint) 14*61146Sbostic ASMSTR("@(#)strlen.s 8.1 (Berkeley) 06/04/93") 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