diff options
| author | Paul Eggert | 2013-11-13 18:39:28 -0800 |
|---|---|---|
| committer | Paul Eggert | 2013-11-13 18:39:28 -0800 |
| commit | 2cf00efc1b0db0ddc26fa14239026dd2d12c7d59 (patch) | |
| tree | 1bd3fcc233230eb7e2ffdee78da9433b3915623e /src/lread.c | |
| parent | d672ac3c611453c624948ed8cc2ced65cadc3400 (diff) | |
| download | emacs-2cf00efc1b0db0ddc26fa14239026dd2d12c7d59.tar.gz emacs-2cf00efc1b0db0ddc26fa14239026dd2d12c7d59.zip | |
Simplify, port and tune bool vector implementation.
* configure.ac (BITSIZEOF_SIZE_T, SIZEOF_SIZE_T): Remove.
* src/alloc.c (bool_vector_exact_payload_bytes)
(bool_vector_payload_bytes): Remove.
(bool_vector_fill): Return its argument.
* src/alloc.c (bool_vector_fill):
* src/lread.c (read1):
* src/print.c (print_object):
Simplify by using bool_vector_bytes.
* src/alloc.c (make_uninit_bool_vector):
New function, broken out from Fmake_bool_vector.
(Fmake_bool_vector): Use it. Use tail call.
(make_uninit_bool_vector, vector_nbytes): Simplify size calculations.
* src/data.c (BITS_PER_ULL): New constant.
(ULLONG_MAX, count_one_bits_ll): Fall back on long counterparts
if long long versions don't exist.
(shift_right_ull): New function.
(count_one_bits_word): New function, replacing popcount_bits_word
macro. Don't assume that bits_word is no wider than long long.
(count_one_bits_word, count_trailing_zero_bits):
Don't assume that bits_word is no wider than long long.
* src/data.c (bool_vector_binop_driver, bool_vector_not):
* src/fns.c (Fcopy_sequence):
* src/lread.c (read1):
Create an uninitialized destination, to avoid needless work.
(internal_equal): Simplify.
(Ffillarray): Prefer tail call.
* src/data.c (bool_vector_binop_driver): Don't assume bit vectors always
contain at least one word.
(bits_word_to_host_endian): Prefer if to #if. Don't assume
chars are narrower than ints.
* src/data.c (Fbool_vector_count_matches, Fbool_vector_count_matches_at):
* src/fns.c (Fcopy_sequence):
Simplify and tune.
* src/lisp.h (bits_word, BITS_WORD_MAX, BITS_PER_BITS_WORD):
Don't try to port to hosts where bits_word values have holes; the
code wouldn't work there anyway. Verify this assumption, though.
(bool_vector_bytes): New function.
(make_uninit_bool_vector): New decl.
(bool_vector_fill): Now returns Lisp_Object.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lread.c b/src/lread.c index 7e4f5d38d09..6c1b17f62b7 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2577,9 +2577,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2577 | if (c == '"') | 2577 | if (c == '"') |
| 2578 | { | 2578 | { |
| 2579 | Lisp_Object tmp, val; | 2579 | Lisp_Object tmp, val; |
| 2580 | EMACS_INT size_in_chars | 2580 | EMACS_INT size_in_chars = bool_vector_bytes (XFASTINT (length)); |
| 2581 | = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1) | ||
| 2582 | / BOOL_VECTOR_BITS_PER_CHAR); | ||
| 2583 | unsigned char *data; | 2581 | unsigned char *data; |
| 2584 | 2582 | ||
| 2585 | UNREAD (c); | 2583 | UNREAD (c); |
| @@ -2594,7 +2592,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2594 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) | 2592 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) |
| 2595 | invalid_syntax ("#&..."); | 2593 | invalid_syntax ("#&..."); |
| 2596 | 2594 | ||
| 2597 | val = Fmake_bool_vector (length, Qnil); | 2595 | val = make_uninit_bool_vector (XFASTINT (length)); |
| 2598 | data = bool_vector_uchar_data (val); | 2596 | data = bool_vector_uchar_data (val); |
| 2599 | memcpy (data, SDATA (tmp), size_in_chars); | 2597 | memcpy (data, SDATA (tmp), size_in_chars); |
| 2600 | /* Clear the extraneous bits in the last byte. */ | 2598 | /* Clear the extraneous bits in the last byte. */ |