Commit c0c1ee9f authored by Paul Eggert's avatar Paul Eggert

* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.

parent a498d7f4
2011-06-18 Paul Eggert <eggert@cs.ucla.edu>
* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
* fns.c (concat): Catch string overflow earlier.
Do not rely on integer wraparound.
......
......@@ -2257,12 +2257,14 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
p = XBOOL_VECTOR (val);
p->size = XFASTINT (length);
memset (p->data, NILP (init) ? 0 : -1, length_in_chars);
if (length_in_chars)
{
memset (p->data, ! NILP (init) ? -1 : 0, length_in_chars);
/* Clear the extraneous bits in the last byte. */
if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
p->data[length_in_chars - 1]
&= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
/* Clear any extraneous bits in the last byte. */
p->data[length_in_chars - 1]
&= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 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