Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libc/mips/string/strchr.S
Show All 38 Lines | #if defined(LIBC_SCCS) && !defined(lint) | ||||
ASMSTR("from: @(#)index.s 8.1 (Berkeley) 6/4/93") | ASMSTR("from: @(#)index.s 8.1 (Berkeley) 6/4/93") | ||||
ASMSTR("$NetBSD: index.S,v 1.8 2005/04/22 06:59:00 simonb Exp $") | ASMSTR("$NetBSD: index.S,v 1.8 2005/04/22 06:59:00 simonb Exp $") | ||||
#endif /* LIBC_SCCS and not lint */ | #endif /* LIBC_SCCS and not lint */ | ||||
#ifdef __ABICALLS__ | #ifdef __ABICALLS__ | ||||
.abicalls | .abicalls | ||||
#endif | #endif | ||||
/* | |||||
* char * | |||||
* strchr(const char *s, int c); | |||||
*/ | |||||
LEAF(strchr) | LEAF(strchr) | ||||
and a1, a1, 0xff | |||||
1: | 1: | ||||
lbu a2, 0(a0) # get a byte | lbu a2, 0(a0) # get a byte | ||||
PTR_ADDU a0, a0, 1 | PTR_ADDU a0, a0, 1 | ||||
beq a2, a1, fnd | beq a2, a1, fnd | ||||
bne a2, zero, 1b | bne a2, zero, 1b | ||||
notfnd: | notfnd: | ||||
move v0, zero | move v0, zero | ||||
j ra | j ra | ||||
fnd: | fnd: | ||||
PTR_SUBU v0, a0, 1 | PTR_SUBU v0, a0, 1 | ||||
j ra | j ra | ||||
END(strchr) | END(strchr) | ||||
WEAK_ALIAS(index, strchr) | WEAK_ALIAS(index, strchr) |