Commit 83713154 authored by Paul Eggert's avatar Paul Eggert

* 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.
parent d06714cb
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.
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment