1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 08:43:40 -07:00

* alloc.c (Fmake_bool_vector): Fix off-by-8 bug

when invoking (make-bool-vector N t) and N is a positive
multiple of 8 -- the last 8 bits were mistakenly cleared.
This commit is contained in:
Paul Eggert 2012-07-18 10:29:34 -07:00
parent d06714cb44
commit 837131548b
2 changed files with 5 additions and 1 deletions

View file

@ -1,5 +1,9 @@
2012-07-18 Paul Eggert <eggert@cs.ucla.edu>
* alloc.c (Fmake_bool_vector): Fix off-by-8 bug
when invoking (make-bool-vector N t) and N is a positive
multiple of 8 -- the last 8 bits were mistakenly cleared.
Remove some struct layout assumptions in bool vectors.
* alloc.c (bool_header_size): New constant.
(header_size, word_size): Move earlier, as they're now used earlier.

View file

@ -2389,7 +2389,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
/* Clear any extraneous bits in the last byte. */
p->data[length_in_chars - 1]
&= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
&= (1 << ((XFASTINT (length) - 1) % BOOL_VECTOR_BITS_PER_CHAR + 1)) - 1;
}
return val;