Fix strchr, strrchr implementation: convert c to char

(according to standard).

Discussed with:	andrew
Reviewed by:	emaste
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8239
This commit is contained in:
Ruslan Bukin 2016-10-13 15:23:53 +00:00
parent 5975e53d40
commit 2302bd3539
2 changed files with 10 additions and 0 deletions

View File

@ -44,7 +44,12 @@ __FBSDID("$FreeBSD$");
.abicalls
#endif
/*
* char *
* strchr(const char *s, int c);
*/
LEAF(strchr)
and a1, a1, 0xff
1:
lbu a2, 0(a0) # get a byte
PTR_ADDU a0, a0, 1

View File

@ -44,8 +44,13 @@ __FBSDID("$FreeBSD$");
.abicalls
#endif
/*
* char *
* strrchr(const char *s, int c);
*/
LEAF(strrchr)
move v0, zero # default if not found
and a1, a1, 0xff
1:
lbu a3, 0(a0) # get a byte
PTR_ADDU a0, a0, 1