svn commit: r307219 - head/lib/libc/mips/string

Ruslan Bukin br at FreeBSD.org
Thu Oct 13 15:23:54 UTC 2016


Author: br
Date: Thu Oct 13 15:23:53 2016
New Revision: 307219
URL: https://svnweb.freebsd.org/changeset/base/307219

Log:
  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

Modified:
  head/lib/libc/mips/string/strchr.S
  head/lib/libc/mips/string/strrchr.S

Modified: head/lib/libc/mips/string/strchr.S
==============================================================================
--- head/lib/libc/mips/string/strchr.S	Thu Oct 13 14:41:05 2016	(r307218)
+++ head/lib/libc/mips/string/strchr.S	Thu Oct 13 15:23:53 2016	(r307219)
@@ -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

Modified: head/lib/libc/mips/string/strrchr.S
==============================================================================
--- head/lib/libc/mips/string/strrchr.S	Thu Oct 13 14:41:05 2016	(r307218)
+++ head/lib/libc/mips/string/strrchr.S	Thu Oct 13 15:23:53 2016	(r307219)
@@ -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


More information about the svn-src-head mailing list