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:
parent
a498d7f4f8
commit
c0c1ee9f77
2 changed files with 9 additions and 5 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
12
src/alloc.c
12
src/alloc.c
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue