aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 723d664cbe0..29351952860 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1950,10 +1950,11 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
1950 1950
1951 CHECK_NATNUM (length); 1951 CHECK_NATNUM (length);
1952 1952
1953 bits_per_value = sizeof (EMACS_INT) * BITS_PER_CHAR; 1953 bits_per_value = sizeof (EMACS_INT) * BOOL_VECTOR_BITS_PER_CHAR;
1954 1954
1955 length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; 1955 length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value;
1956 length_in_chars = ((XFASTINT (length) + BITS_PER_CHAR - 1) / BITS_PER_CHAR); 1956 length_in_chars = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1)
1957 / BOOL_VECTOR_BITS_PER_CHAR);
1957 1958
1958 /* We must allocate one more elements than LENGTH_IN_ELTS for the 1959 /* We must allocate one more elements than LENGTH_IN_ELTS for the
1959 slot `size' of the struct Lisp_Bool_Vector. */ 1960 slot `size' of the struct Lisp_Bool_Vector. */
@@ -1970,9 +1971,9 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
1970 p->data[i] = real_init; 1971 p->data[i] = real_init;
1971 1972
1972 /* Clear the extraneous bits in the last byte. */ 1973 /* Clear the extraneous bits in the last byte. */
1973 if (XINT (length) != length_in_chars * BITS_PER_CHAR) 1974 if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
1974 XBOOL_VECTOR (val)->data[length_in_chars - 1] 1975 XBOOL_VECTOR (val)->data[length_in_chars - 1]
1975 &= (1 << (XINT (length) % BITS_PER_CHAR)) - 1; 1976 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
1976 1977
1977 return val; 1978 return val;
1978} 1979}