diff options
| author | Andreas Schwab | 2004-04-26 21:42:49 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2004-04-26 21:42:49 +0000 |
| commit | a097329fe7a950368fb74e75855488813eace8d5 (patch) | |
| tree | 0e0e113a4c02f7a8336a6723000b47bc67c09325 /src | |
| parent | d1ca81d9a8aaf60d46e3f8e4838b2dfd3831764d (diff) | |
| download | emacs-a097329fe7a950368fb74e75855488813eace8d5.tar.gz emacs-a097329fe7a950368fb74e75855488813eace8d5.zip | |
(Fmake_bool_vector): Use BOOL_VECTOR_BITS_PER_CHAR instead of
BITS_PER_CHAR for bool vectors.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c index 7be54aa1ae0..b5a96953adb 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1949,10 +1949,11 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 1949 | 1949 | ||
| 1950 | CHECK_NATNUM (length); | 1950 | CHECK_NATNUM (length); |
| 1951 | 1951 | ||
| 1952 | bits_per_value = sizeof (EMACS_INT) * BITS_PER_CHAR; | 1952 | bits_per_value = sizeof (EMACS_INT) * BOOL_VECTOR_BITS_PER_CHAR; |
| 1953 | 1953 | ||
| 1954 | length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; | 1954 | length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; |
| 1955 | length_in_chars = ((XFASTINT (length) + BITS_PER_CHAR - 1) / BITS_PER_CHAR); | 1955 | length_in_chars = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1) |
| 1956 | / BOOL_VECTOR_BITS_PER_CHAR); | ||
| 1956 | 1957 | ||
| 1957 | /* We must allocate one more elements than LENGTH_IN_ELTS for the | 1958 | /* We must allocate one more elements than LENGTH_IN_ELTS for the |
| 1958 | slot `size' of the struct Lisp_Bool_Vector. */ | 1959 | slot `size' of the struct Lisp_Bool_Vector. */ |
| @@ -1969,9 +1970,9 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 1969 | p->data[i] = real_init; | 1970 | p->data[i] = real_init; |
| 1970 | 1971 | ||
| 1971 | /* Clear the extraneous bits in the last byte. */ | 1972 | /* Clear the extraneous bits in the last byte. */ |
| 1972 | if (XINT (length) != length_in_chars * BITS_PER_CHAR) | 1973 | if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR) |
| 1973 | XBOOL_VECTOR (val)->data[length_in_chars - 1] | 1974 | XBOOL_VECTOR (val)->data[length_in_chars - 1] |
| 1974 | &= (1 << (XINT (length) % BITS_PER_CHAR)) - 1; | 1975 | &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; |
| 1975 | 1976 | ||
| 1976 | return val; | 1977 | return val; |
| 1977 | } | 1978 | } |