diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-10-16 18:02:32 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-10-16 18:02:32 -0700 |
commit | f2752e013d24133b645d60b226579f8ae9f1587d (patch) | |
tree | 0acb15dc969d0fa34554a6df0d407708d22f8d45 /src | |
parent | 7a550bbb1a6be5a4a562e5c8aacee96014a985a9 (diff) | |
download | emacs-f2752e013d24133b645d60b226579f8ae9f1587d.tar.gz |
bool vector int width fixes
* data.c (bool_vector_spare_mask, Fbool_vector_count_matches)
(Fbool_vector_count_matches_at):
Use EMACS_INT, not ptrdiff_t, to record bit counts, as a bit count
can exceed PTRDIFF_MAX, at least in theory.
(Fbool_vector_count_matches_at):
Use int, not ptrdiff_t, to record a value that can't exceed INT_MAX.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 10 | ||||
-rw-r--r-- | src/data.c | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b0774188c10..2e175a723dc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2013-10-17 Paul Eggert <eggert@cs.ucla.edu> + + bool vector int width fixes + * data.c (bool_vector_spare_mask, Fbool_vector_count_matches) + (Fbool_vector_count_matches_at): + Use EMACS_INT, not ptrdiff_t, to record bit counts, as a bit count + can exceed PTRDIFF_MAX, at least in theory. + (Fbool_vector_count_matches_at): + Use int, not ptrdiff_t, to record a value that can't exceed INT_MAX. + 2013-10-16 Paul Eggert <eggert@cs.ucla.edu> * process.h (conv_sockaddr_to_lisp): New decl, for newly-extern func. diff --git a/src/data.c b/src/data.c index 9314add11aa..22d051ef932 100644 --- a/src/data.c +++ b/src/data.c @@ -2980,7 +2980,7 @@ lowercase l) for small endian machines. */) that we don't have to special-case empty bit vectors. */ static bits_word -bool_vector_spare_mask (ptrdiff_t nr_bits) +bool_vector_spare_mask (EMACS_INT nr_bits) { return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; } @@ -3218,7 +3218,7 @@ DEFUN ("bool-vector-count-matches", Fbool_vector_count_matches, A must be a bool vector. B is a generalized bool. */) (Lisp_Object a, Lisp_Object b) { - ptrdiff_t count; + EMACS_INT count; EMACS_INT nr_bits; bits_word *adata; bits_word match; @@ -3253,9 +3253,9 @@ A must be a bool vector. B is a generalized boolean. i is an index into the vector. */) (Lisp_Object a, Lisp_Object b, Lisp_Object i) { - ptrdiff_t count; + EMACS_INT count; EMACS_INT nr_bits; - ptrdiff_t offset; + int offset; bits_word *adata; bits_word twiddle; bits_word mword; /* Machine word. */ |