diff options
| author | Paul Eggert | 2013-10-14 00:12:49 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-10-14 00:12:49 -0700 |
| commit | 1c0a74936b61e1f7e662089126a0765e25bf2c29 (patch) | |
| tree | 8d57ee533b81b8aeb0bade9f327e385d91418c98 /src/data.c | |
| parent | 1eda1d8d34c864df5b89464e51f0cbb8e46c5afd (diff) | |
| download | emacs-1c0a74936b61e1f7e662089126a0765e25bf2c29.tar.gz emacs-1c0a74936b61e1f7e662089126a0765e25bf2c29.zip | |
* lisp.h (bool_vector_size): New function.
All uses of XBOOL_VECTOR (x)->size changed to bool_vector_size (x).
* data.c (bool_vector_spare_mask, bool_vector_binop_driver)
(Fbool_vector_not, Fbool_vector_count_matches_at):
Remove uses of 'eassume' that should no longer be needed,
because they are subsumed by the 'eassume' in bool_vector_size.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/data.c b/src/data.c index b4257243fb3..dea70ca42d6 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2130,7 +2130,7 @@ or a byte-code object. IDX starts at 0. */) | |||
| 2130 | { | 2130 | { |
| 2131 | int val; | 2131 | int val; |
| 2132 | 2132 | ||
| 2133 | if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size) | 2133 | if (idxval < 0 || idxval >= bool_vector_size (array)) |
| 2134 | args_out_of_range (array, idx); | 2134 | args_out_of_range (array, idx); |
| 2135 | 2135 | ||
| 2136 | val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR]; | 2136 | val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR]; |
| @@ -2180,7 +2180,7 @@ bool-vector. IDX starts at 0. */) | |||
| 2180 | { | 2180 | { |
| 2181 | int val; | 2181 | int val; |
| 2182 | 2182 | ||
| 2183 | if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size) | 2183 | if (idxval < 0 || idxval >= bool_vector_size (array)) |
| 2184 | args_out_of_range (array, idx); | 2184 | args_out_of_range (array, idx); |
| 2185 | 2185 | ||
| 2186 | val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR]; | 2186 | val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR]; |
| @@ -2969,7 +2969,6 @@ lowercase l) for small endian machines. */) | |||
| 2969 | static bits_word | 2969 | static bits_word |
| 2970 | bool_vector_spare_mask (ptrdiff_t nr_bits) | 2970 | bool_vector_spare_mask (ptrdiff_t nr_bits) |
| 2971 | { | 2971 | { |
| 2972 | eassume (nr_bits > 0); | ||
| 2973 | return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; | 2972 | return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; |
| 2974 | } | 2973 | } |
| 2975 | 2974 | ||
| @@ -3005,8 +3004,7 @@ bool_vector_binop_driver (Lisp_Object op1, | |||
| 3005 | CHECK_BOOL_VECTOR (op1); | 3004 | CHECK_BOOL_VECTOR (op1); |
| 3006 | CHECK_BOOL_VECTOR (op2); | 3005 | CHECK_BOOL_VECTOR (op2); |
| 3007 | 3006 | ||
| 3008 | nr_bits = min (XBOOL_VECTOR (op1)->size, | 3007 | nr_bits = min (bool_vector_size (op1), bool_vector_size (op2)); |
| 3009 | XBOOL_VECTOR (op2)->size); | ||
| 3010 | 3008 | ||
| 3011 | if (NILP (dest)) | 3009 | if (NILP (dest)) |
| 3012 | { | 3010 | { |
| @@ -3016,10 +3014,9 @@ bool_vector_binop_driver (Lisp_Object op1, | |||
| 3016 | else | 3014 | else |
| 3017 | { | 3015 | { |
| 3018 | CHECK_BOOL_VECTOR (dest); | 3016 | CHECK_BOOL_VECTOR (dest); |
| 3019 | nr_bits = min (nr_bits, XBOOL_VECTOR (dest)->size); | 3017 | nr_bits = min (nr_bits, bool_vector_size (dest)); |
| 3020 | } | 3018 | } |
| 3021 | 3019 | ||
| 3022 | eassume (nr_bits >= 0); | ||
| 3023 | nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD; | 3020 | nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD; |
| 3024 | 3021 | ||
| 3025 | adata = (bits_word *) XBOOL_VECTOR (dest)->data; | 3022 | adata = (bits_word *) XBOOL_VECTOR (dest)->data; |
| @@ -3172,21 +3169,19 @@ Return the destination vector. */) | |||
| 3172 | bits_word mword; | 3169 | bits_word mword; |
| 3173 | 3170 | ||
| 3174 | CHECK_BOOL_VECTOR (a); | 3171 | CHECK_BOOL_VECTOR (a); |
| 3175 | nr_bits = XBOOL_VECTOR (a)->size; | 3172 | nr_bits = bool_vector_size (a); |
| 3176 | 3173 | ||
| 3177 | if (NILP (b)) | 3174 | if (NILP (b)) |
| 3178 | b = Fmake_bool_vector (make_number (nr_bits), Qnil); | 3175 | b = Fmake_bool_vector (make_number (nr_bits), Qnil); |
| 3179 | else | 3176 | else |
| 3180 | { | 3177 | { |
| 3181 | CHECK_BOOL_VECTOR (b); | 3178 | CHECK_BOOL_VECTOR (b); |
| 3182 | nr_bits = min (nr_bits, XBOOL_VECTOR (b)->size); | 3179 | nr_bits = min (nr_bits, bool_vector_size (b)); |
| 3183 | } | 3180 | } |
| 3184 | 3181 | ||
| 3185 | bdata = (bits_word *) XBOOL_VECTOR (b)->data; | 3182 | bdata = (bits_word *) XBOOL_VECTOR (b)->data; |
| 3186 | adata = (bits_word *) XBOOL_VECTOR (a)->data; | 3183 | adata = (bits_word *) XBOOL_VECTOR (a)->data; |
| 3187 | 3184 | ||
| 3188 | eassume (nr_bits >= 0); | ||
| 3189 | |||
| 3190 | for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; i++) | 3185 | for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; i++) |
| 3191 | bdata[i] = ~adata[i]; | 3186 | bdata[i] = ~adata[i]; |
| 3192 | 3187 | ||
| @@ -3215,13 +3210,11 @@ A must be a bool vector. B is a generalized bool. */) | |||
| 3215 | 3210 | ||
| 3216 | CHECK_BOOL_VECTOR (a); | 3211 | CHECK_BOOL_VECTOR (a); |
| 3217 | 3212 | ||
| 3218 | nr_bits = XBOOL_VECTOR (a)->size; | 3213 | nr_bits = bool_vector_size (a); |
| 3219 | count = 0; | 3214 | count = 0; |
| 3220 | match = NILP (b) ? -1 : 0; | 3215 | match = NILP (b) ? -1 : 0; |
| 3221 | adata = (bits_word *) XBOOL_VECTOR (a)->data; | 3216 | adata = (bits_word *) XBOOL_VECTOR (a)->data; |
| 3222 | 3217 | ||
| 3223 | eassume (nr_bits >= 0); | ||
| 3224 | |||
| 3225 | for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; ++i) | 3218 | for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; ++i) |
| 3226 | count += popcount_bits_word (adata[i] ^ match); | 3219 | count += popcount_bits_word (adata[i] ^ match); |
| 3227 | 3220 | ||
| @@ -3256,13 +3249,12 @@ index into the vector. */) | |||
| 3256 | CHECK_BOOL_VECTOR (a); | 3249 | CHECK_BOOL_VECTOR (a); |
| 3257 | CHECK_NATNUM (i); | 3250 | CHECK_NATNUM (i); |
| 3258 | 3251 | ||
| 3259 | nr_bits = XBOOL_VECTOR (a)->size; | 3252 | nr_bits = bool_vector_size (a); |
| 3260 | if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */ | 3253 | if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */ |
| 3261 | args_out_of_range (a, i); | 3254 | args_out_of_range (a, i); |
| 3262 | 3255 | ||
| 3263 | adata = (bits_word *) XBOOL_VECTOR (a)->data; | 3256 | adata = (bits_word *) XBOOL_VECTOR (a)->data; |
| 3264 | 3257 | ||
| 3265 | eassume (nr_bits >= 0); | ||
| 3266 | nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD; | 3258 | nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD; |
| 3267 | 3259 | ||
| 3268 | pos = XFASTINT (i) / BITS_PER_BITS_WORD; | 3260 | pos = XFASTINT (i) / BITS_PER_BITS_WORD; |