1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 03:40:56 -08:00

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

This commit is contained in:
Paul Eggert 2011-06-18 08:39:24 -07:00
parent a498d7f4f8
commit c0c1ee9f77
2 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,7 @@
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.

View file

@ -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;
}