xref: /original-bsd/lib/libc/mips/string/strlen.s (revision 381fb7ab)
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Ralph Campbell.
7 *
8 * %sccs.include.redist.c%
9 */
10
11#include "DEFS.h"
12
13#if defined(LIBC_SCCS) && !defined(lint)
14	ASMSTR("@(#)strlen.s	5.2 (Berkeley) 02/29/92")
15#endif /* LIBC_SCCS and not lint */
16
17LEAF(strlen)
18	addu	v1, a0, 1
191:
20	lb	v0, 0(a0)		# get byte from string
21	addu	a0, a0, 1		# increment pointer
22	bne	v0, zero, 1b		# continue if not end
23	subu	v0, a0, v1		# compute length - 1 for '\0' char
24	j	ra
25END(strlen)
26