aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-10-16 18:02:32 -0700
committerPaul Eggert2013-10-16 18:02:32 -0700
commitf2752e013d24133b645d60b226579f8ae9f1587d (patch)
tree0acb15dc969d0fa34554a6df0d407708d22f8d45 /src
parent7a550bbb1a6be5a4a562e5c8aacee96014a985a9 (diff)
downloademacs-f2752e013d24133b645d60b226579f8ae9f1587d.tar.gz
emacs-f2752e013d24133b645d60b226579f8ae9f1587d.zip
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/ChangeLog10
-rw-r--r--src/data.c8
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 @@
12013-10-17 Paul Eggert <eggert@cs.ucla.edu>
2
3 bool vector int width fixes
4 * data.c (bool_vector_spare_mask, Fbool_vector_count_matches)
5 (Fbool_vector_count_matches_at):
6 Use EMACS_INT, not ptrdiff_t, to record bit counts, as a bit count
7 can exceed PTRDIFF_MAX, at least in theory.
8 (Fbool_vector_count_matches_at):
9 Use int, not ptrdiff_t, to record a value that can't exceed INT_MAX.
10
12013-10-16 Paul Eggert <eggert@cs.ucla.edu> 112013-10-16 Paul Eggert <eggert@cs.ucla.edu>
2 12
3 * process.h (conv_sockaddr_to_lisp): New decl, for newly-extern func. 13 * 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. */)
2980 that we don't have to special-case empty bit vectors. */ 2980 that we don't have to special-case empty bit vectors. */
2981 2981
2982static bits_word 2982static bits_word
2983bool_vector_spare_mask (ptrdiff_t nr_bits) 2983bool_vector_spare_mask (EMACS_INT nr_bits)
2984{ 2984{
2985 return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; 2985 return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1;
2986} 2986}
@@ -3218,7 +3218,7 @@ DEFUN ("bool-vector-count-matches", Fbool_vector_count_matches,
3218A must be a bool vector. B is a generalized bool. */) 3218A must be a bool vector. B is a generalized bool. */)
3219 (Lisp_Object a, Lisp_Object b) 3219 (Lisp_Object a, Lisp_Object b)
3220{ 3220{
3221 ptrdiff_t count; 3221 EMACS_INT count;
3222 EMACS_INT nr_bits; 3222 EMACS_INT nr_bits;
3223 bits_word *adata; 3223 bits_word *adata;
3224 bits_word match; 3224 bits_word match;
@@ -3253,9 +3253,9 @@ A must be a bool vector. B is a generalized boolean. i is an
3253index into the vector. */) 3253index into the vector. */)
3254 (Lisp_Object a, Lisp_Object b, Lisp_Object i) 3254 (Lisp_Object a, Lisp_Object b, Lisp_Object i)
3255{ 3255{
3256 ptrdiff_t count; 3256 EMACS_INT count;
3257 EMACS_INT nr_bits; 3257 EMACS_INT nr_bits;
3258 ptrdiff_t offset; 3258 int offset;
3259 bits_word *adata; 3259 bits_word *adata;
3260 bits_word twiddle; 3260 bits_word twiddle;
3261 bits_word mword; /* Machine word. */ 3261 bits_word mword; /* Machine word. */