]> git.eshelyaron.com Git - emacs.git/commit
Optimize smallish mpz to native int conversion
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 11 Jul 2024 10:42:57 +0000 (12:42 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 11 Jul 2024 14:39:50 +0000 (16:39 +0200)
commit2d1f5de16ef6c0be14355f294326d98c6fb6348b
tree5b0c8adc00996b8a4aedd456e0cd0100a6e966b4
parent3670a282710b907543910a6de8e2732c1ef9da77
Optimize smallish mpz to native int conversion

* src/bignum.c (make_integer_mpz, mpz_to_intmax):
If FASTER_BIGNUM, optimize the common case where the value fits in
long int.  In this case we can use mpz_fits_slong_p and mpz_get_si
instead of looping with mpz_getlimbn.
(mpz_to_uintmax): Likewise for unsigned long int and mpz_get_ui.

(cherry picked from commit 0c850df888ebb68096a82ab32089e809de591620)
src/bignum.c