summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-06-18 08:39:24 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-06-18 08:39:24 -0700
commitc0c1ee9f77d41298cd3b576fdf8b97e5d8d87e17 (patch)
tree36eb43aa1802e62b112ddd41461dbd0a0dbf076b /src/alloc.c
parenta498d7f4f8ce688079d32cac4858ba78d2a9081e (diff)
downloademacs-c0c1ee9f77d41298cd3b576fdf8b97e5d8d87e17.tar.gz
* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c12
1 files changed, 7 insertions, 5 deletions
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. */)
p = XBOOL_VECTOR (val);
p->size = XFASTINT (length);
- memset (p->data, NILP (init) ? 0 : -1, length_in_chars);
+ if (length_in_chars)
+ {
+ memset (p->data, ! NILP (init) ? -1 : 0, length_in_chars);
- /* Clear the extraneous bits in the last byte. */
- if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
- p->data[length_in_chars - 1]
- &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
+ /* Clear any extraneous bits in the last byte. */
+ p->data[length_in_chars - 1]
+ &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
+ }
return val;
}