aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2016-02-05 14:37:09 -0800
committerPaul Eggert2016-02-05 14:37:38 -0800
commit130056880fe9d807fbaee5bc5f68249ea9cf6438 (patch)
tree2f9ffdb9a8ed045b84dce2421d4a147f4b7a79a5 /src/alloc.c
parentf8a8da25353efc54fd24f4ea5c7ed0ad85378b98 (diff)
downloademacs-130056880fe9d807fbaee5bc5f68249ea9cf6438.tar.gz
emacs-130056880fe9d807fbaee5bc5f68249ea9cf6438.zip
Omit XLI (init) == 0 optimization in make-vector
* src/alloc.c (Fmake_vector): Simplify by omitting the (XLI (init) == 0) case, as this optimization is probably not worth the hassle. Just for the record, the test for that case could have been (XLI (init) % ((EMACS_UINT) -1 / UCHAR_MAX) == 0) (!), assuming the typical platform with no padding bits and where conversion to int omits the most significant bits.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 031c78c07ca..92945bc8afc 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3321,14 +3321,9 @@ See also the function `vector'. */)
3321 (Lisp_Object length, Lisp_Object init) 3321 (Lisp_Object length, Lisp_Object init)
3322{ 3322{
3323 CHECK_NATNUM (length); 3323 CHECK_NATNUM (length);
3324
3325 struct Lisp_Vector *p = allocate_vector (XFASTINT (length)); 3324 struct Lisp_Vector *p = allocate_vector (XFASTINT (length));
3326 if (XLI (init) == 0) 3325 for (ptrdiff_t i = 0; i < XFASTINT (length); i++)
3327 memset (p->contents, 0, XFASTINT (length) * sizeof p->contents[0]); 3326 p->contents[i] = init;
3328 else
3329 for (ptrdiff_t i = 0; i < XFASTINT (length); i++)
3330 p->contents[i] = init;
3331
3332 return make_lisp_ptr (p, Lisp_Vectorlike); 3327 return make_lisp_ptr (p, Lisp_Vectorlike);
3333} 3328}
3334 3329