aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c
index b41af98ac4f..e010f8501bc 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1237,7 +1237,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil.")
1237 bits_per_value = sizeof (EMACS_INT) * BITS_PER_CHAR; 1237 bits_per_value = sizeof (EMACS_INT) * BITS_PER_CHAR;
1238 1238
1239 length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; 1239 length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value;
1240 length_in_chars = length_in_elts * sizeof (EMACS_INT); 1240 length_in_chars = ((XFASTINT (length) + BITS_PER_CHAR - 1) / BITS_PER_CHAR);
1241 1241
1242 /* We must allocate one more elements than LENGTH_IN_ELTS for the 1242 /* We must allocate one more elements than LENGTH_IN_ELTS for the
1243 slot `size' of the struct Lisp_Bool_Vector. */ 1243 slot `size' of the struct Lisp_Bool_Vector. */
@@ -1251,6 +1251,10 @@ LENGTH must be a number. INIT matters only in whether it is t or nil.")
1251 real_init = (NILP (init) ? 0 : -1); 1251 real_init = (NILP (init) ? 0 : -1);
1252 for (i = 0; i < length_in_chars ; i++) 1252 for (i = 0; i < length_in_chars ; i++)
1253 p->data[i] = real_init; 1253 p->data[i] = real_init;
1254 /* Clear the extraneous bits in the last byte. */
1255 if (XINT (length) != length_in_chars * BITS_PER_CHAR)
1256 XBOOL_VECTOR (val)->data[length_in_chars - 1]
1257 &= (1 << (XINT (length) % BITS_PER_CHAR)) - 1;
1254 1258
1255 return val; 1259 return val;
1256} 1260}