changeset 53159:e929f6d1593b

(internal_equal) <case Lisp_Vectorlike>: Declare size as EMACS_INT to not lose bits. (Ffillarray): Don't set bits beyond the size of a bool vector.
author Andreas Schwab <schwab@suse.de>
date Tue, 25 Nov 2003 12:21:46 +0000
parents 1025f21ef0c9
children f71ce92df3cb
files src/fns.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Tue Nov 25 09:48:15 2003 +0000
+++ b/src/fns.c	Tue Nov 25 12:21:46 2003 +0000
@@ -2192,8 +2192,8 @@
 
     case Lisp_Vectorlike:
       {
-	register int i, size;
-	size = XVECTOR (o1)->size;
+	register int i;
+	EMACS_INT size = XVECTOR (o1)->size;
 	/* Pseudovectors have the type encoded in the size field, so this test
 	   actually checks that the objects have the same type as well as the
 	   same size.  */
@@ -2315,8 +2315,15 @@
 	= (XBOOL_VECTOR (array)->size + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
 
       charval = (! NILP (item) ? -1 : 0);
-      for (index = 0; index < size_in_chars; index++)
+      for (index = 0; index < size_in_chars - 1; index++)
 	p[index] = charval;
+      if (index < size_in_chars)
+	{
+	  /* Mask out bits beyond the vector size.  */
+	  if (XBOOL_VECTOR (array)->size % BITS_PER_CHAR)
+	    charval &= (1 << (XBOOL_VECTOR (array)->size % BITS_PER_CHAR)) - 1;
+	  p[index] = charval;
+	}
     }
   else
     {