Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc/arch/mips/string force 2nd to argument to un...



details:   https://anonhg.NetBSD.org/src/rev/d02cb85f4d3c
branches:  trunk
changeset: 338467:d02cb85f4d3c
user:      matt <matt%NetBSD.org@localhost>
date:      Tue May 26 06:55:08 2015 +0000

description:
force 2nd to argument to unsigned byte value.
(found by t_strchr and t_strrchr tests)

diffstat:

 common/lib/libc/arch/mips/string/strchr.S  |  5 +++--
 common/lib/libc/arch/mips/string/strrchr.S |  5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 0f8e83146f10 -r d02cb85f4d3c common/lib/libc/arch/mips/string/strchr.S
--- a/common/lib/libc/arch/mips/string/strchr.S Tue May 26 05:11:33 2015 +0000
+++ b/common/lib/libc/arch/mips/string/strchr.S Tue May 26 06:55:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strchr.S,v 1.3 2011/01/02 02:58:52 matt Exp $  */
+/*     $NetBSD: strchr.S,v 1.4 2015/05/26 06:55:08 matt Exp $  */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
        ASMSTR("from: @(#)index.s       8.1 (Berkeley) 6/4/93")
-       ASMSTR("$NetBSD: strchr.S,v 1.3 2011/01/02 02:58:52 matt Exp $")
+       ASMSTR("$NetBSD: strchr.S,v 1.4 2015/05/26 06:55:08 matt Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef __ABICALLS__
@@ -45,6 +45,7 @@
 
 LEAF(strchr)
 XLEAF(index)
+       and     a1, 0xff                # limit to byte value
 1:
        lbu     a2, 0(a0)               # get a byte
        PTR_ADDU a0, 1
diff -r 0f8e83146f10 -r d02cb85f4d3c common/lib/libc/arch/mips/string/strrchr.S
--- a/common/lib/libc/arch/mips/string/strrchr.S        Tue May 26 05:11:33 2015 +0000
+++ b/common/lib/libc/arch/mips/string/strrchr.S        Tue May 26 06:55:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strrchr.S,v 1.2 2011/01/02 02:58:52 matt Exp $ */
+/*     $NetBSD: strrchr.S,v 1.3 2015/05/26 06:55:08 matt Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
        ASMSTR("from: @(#)rindex.s      8.1 (Berkeley) 6/4/93")
-       ASMSTR("$NetBSD: strrchr.S,v 1.2 2011/01/02 02:58:52 matt Exp $")
+       ASMSTR("$NetBSD: strrchr.S,v 1.3 2015/05/26 06:55:08 matt Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef __ABICALLS__
@@ -45,6 +45,7 @@
 
 LEAF(strrchr)
 XLEAF(rindex)
+       and     a1, 0xff                # limit to byte value
        move    v0, zero                # default if not found
 1:
        lbu     a3, 0(a0)               # get a byte



Home | Main Index | Thread Index | Old Index