Truncate the character arguments of strchr() and strrchr() to eight bits
so that the implied char conversion would work correctly. Otherwise the
functions would always return NULL when the character argument is
negative.
OK miod@
-/* $OpenBSD: strchr.S,v 1.3 2015/08/31 02:53:56 guenther Exp $ */
+/* $OpenBSD: strchr.S,v 1.4 2021/07/24 05:35:56 visa Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
LEAF(strchr, 0)
.set reorder
+ andi a1, 0xff
0:
lbu a2, 0(a0) # get a byte
daddu a0, a0, 1
-/* $OpenBSD: strrchr.S,v 1.3 2015/08/31 02:53:56 guenther Exp $ */
+/* $OpenBSD: strrchr.S,v 1.4 2021/07/24 05:35:56 visa Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
LEAF(strrchr, 0)
.set reorder
move v0, zero # default if not found
+ andi a1, 0xff
1:
lbu a3, 0(a0) # get a byte
daddu a0, a0, 1