xref: /csrg-svn/lib/libc/mips/string/strlen.s (revision 55708)
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*55708Sralph#include <machine/machAsmDefs.h>
1252737Sbostic
1352720Sbostic#if defined(LIBC_SCCS) && !defined(lint)
14*55708Sralph	ASMSTR("@(#)strlen.s	5.3 (Berkeley) 07/26/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