about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--sysdeps/alpha/strlen.c9
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a8f87aa9ed..2d5e531c8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
+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.
+
 Sun Apr 16 03:23:09 1995  Brendan Kehoe  (brendan@zen.org)
 
-	* /sysdeps/unix/bsd/ultrix4/mips/sysdep.h: New file defining
+	* sysdeps/unix/bsd/ultrix4/mips/sysdep.h: New file defining
 	NO_UNDERSCORES then using sysdeps/unix/mips/sysdep.h.
 
 Fri Apr 14 18:49:03 1995  Brendan Kehoe  (brendan@zen.org)
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;
 	}
     }
 }