diff options
| author | Andreas Schwab <schwab@suse.de> | 2003-11-25 12:22:08 +0000 |
|---|---|---|
| committer | Andreas Schwab <schwab@suse.de> | 2003-11-25 12:22:08 +0000 |
| commit | 00498bfc928ebe82169895fa899785dec5c808e5 (patch) | |
| tree | c040b208417f57896d67d1fb3a94f4149a7d57bd | |
| parent | 95e52d88883c4b5e195f7f27ef3779551621f977 (diff) | |
| download | emacs-00498bfc928ebe82169895fa899785dec5c808e5.tar.gz | |
(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.
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/fns.c | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 95b5f247e4d..605ed62bc3f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2003-11-25 Andreas Schwab <schwab@suse.de> + + * fns.c (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. + 2003-11-25 Kim F. Storm <storm@cua.dk> * print.c (Fredirect_debugging_output) [!GNU_LINUX]: Do not diff --git a/src/fns.c b/src/fns.c index 5d7111a69a4..18bf8d62a8b 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2192,8 +2192,8 @@ internal_equal (o1, o2, depth) 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 @@ ARRAY is a vector, string, char-table, or bool-vector. */) = (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 { |
