about summary refs log tree commit diff
path: root/sysdeps/alpha
diff options
context:
space:
mode:
authorBrendan Kehoe <brendan@zen.org>1995-04-17 22:02:01 +0000
committerBrendan Kehoe <brendan@zen.org>1995-04-17 22:02:01 +0000
commit5fa258865198ba3b54d79d961f2092a407a914e8 (patch)
treebba8c282debad8570d7ad1bef21947fa7a086dca /sysdeps/alpha
parente0585da11141e9c96143fe55d74ec8c0591d1d86 (diff)
downloadglibc-5fa258865198ba3b54d79d961f2092a407a914e8.tar.gz
glibc-5fa258865198ba3b54d79d961f2092a407a914e8.tar.xz
glibc-5fa258865198ba3b54d79d961f2092a407a914e8.zip
* sysdeps/alpha/strlen.c (strlen): Fix cmpbge insn, and returning
of the byte that was zero, so we return a valid number.
Mon Apr 17 12:02:49 1995  Brendan Kehoe  (brendan@zen.org)

	* sysdeps/alpha/strlen.c (strlen): Fix cmpbge insn, and returning
	of the byte that was zero, so we return a valid number.

	* sysdeps/unix/bsd/ultrix4/mips/sysdep.h: New file defining
Diffstat (limited to 'sysdeps/alpha')
-rw-r--r--sysdeps/alpha/strlen.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sysdeps/alpha/strlen.c b/sysdeps/alpha/strlen.c
index d7744476ad..36f106c9c3 100644
--- a/sysdeps/alpha/strlen.c
+++ b/sysdeps/alpha/strlen.c
@@ -36,19 +36,20 @@ strlen (const char *str)
 
   for (;;)
     {
+      const unsigned long int longword = *longword_ptr++;
       int mask;
-      asm ("cmpbge %1, %2, %0" : "=r" (mask) : "r" (0), "r" (*longword_ptr++));
+
+      /* Set bits in MASK if bytes in LONGWORD are zero.  */
+      asm ("cmpbge $31, %1, %0" : "=r" (mask) : "r" (longword));
       if (mask)
 	{
 	  /* Which of the bytes was the zero?  */
-
 	  const char *cp = (const char *) (longword_ptr - 1);
 	  int i;
 
-	  for (i = 0; i < 6; i++)
+	  for (i = 0; i < 8; i++)
 	    if (cp[i] == 0)
 	      return cp - str + i;
-	  return cp - str + 7;
 	}
     }
 }