1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-20 10:23:57 +00:00

Speed up logcount on bignums

* src/data.c (Flogcount): Speed up by using the mpz equivalent
of ~X instead of -X-1.
This commit is contained in:
Paul Eggert 2018-08-16 19:53:21 -07:00
parent 44ad4a15a0
commit bb7e033891

View File

@ -3350,8 +3350,7 @@ representation. */)
return make_fixnum (mpz_popcount (XBIGNUM (value)->value));
mpz_t tem;
mpz_init (tem);
mpz_neg (tem, XBIGNUM (value)->value);
mpz_sub_ui (tem, tem, 1);
mpz_com (tem, XBIGNUM (value)->value);
Lisp_Object result = make_fixnum (mpz_popcount (tem));
mpz_clear (tem);
return result;