summaryrefslogtreecommitdiff
path: root/sys/lib/libkern/arch/mips/strlen.S
blob: 5c72b6bfaf1315c439f6e8cb81edf5f890e7e5d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "DEFS.h"

/*
 * strlen(str)
 */
LEAF(strlen)
	addu	v1, a0, 1
1:
	lb	v0, 0(a0)		# get byte from string
	addu	a0, a0, 1		# increment pointer
	bne	v0, zero, 1b		# continue if not end
	nop
	j	ra
	 subu	v0, a0, v1		# compute length - 1 for '\0' char
END(strlen)