aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-06-18 08:39:24 -0700
committerPaul Eggert2011-06-18 08:39:24 -0700
commitc0c1ee9f77d41298cd3b576fdf8b97e5d8d87e17 (patch)
tree36eb43aa1802e62b112ddd41461dbd0a0dbf076b /src
parenta498d7f4f8ce688079d32cac4858ba78d2a9081e (diff)
downloademacs-c0c1ee9f77d41298cd3b576fdf8b97e5d8d87e17.tar.gz
emacs-c0c1ee9f77d41298cd3b576fdf8b97e5d8d87e17.zip
* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog2
-rw-r--r--src/alloc.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b9cf18cedd9..80626bc0c2a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,7 @@
12011-06-18 Paul Eggert <eggert@cs.ucla.edu> 12011-06-18 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
4
3 * fns.c (concat): Catch string overflow earlier. 5 * fns.c (concat): Catch string overflow earlier.
4 Do not rely on integer wraparound. 6 Do not rely on integer wraparound.
5 7
diff --git a/src/alloc.c b/src/alloc.c
index 00d330c1b6a..69623d103c3 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2257,12 +2257,14 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
2257 p = XBOOL_VECTOR (val); 2257 p = XBOOL_VECTOR (val);
2258 p->size = XFASTINT (length); 2258 p->size = XFASTINT (length);
2259 2259
2260 memset (p->data, NILP (init) ? 0 : -1, length_in_chars); 2260 if (length_in_chars)
2261 {
2262 memset (p->data, ! NILP (init) ? -1 : 0, length_in_chars);
2261 2263
2262 /* Clear the extraneous bits in the last byte. */ 2264 /* Clear any extraneous bits in the last byte. */
2263 if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR) 2265 p->data[length_in_chars - 1]
2264 p->data[length_in_chars - 1] 2266 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
2265 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; 2267 }
2266 2268
2267 return val; 2269 return val;
2268} 2270}