mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
take_mpz optimization
* libguile/integers.c (take_mpz): Avoid making a bignum if the value is fixable.
This commit is contained in:
parent
aa5455ea98
commit
443d239828
1 changed files with 6 additions and 2 deletions
|
@ -299,9 +299,13 @@ normalize_bignum (struct scm_bignum *z)
|
|||
static SCM
|
||||
take_mpz (mpz_ptr mpz)
|
||||
{
|
||||
struct scm_bignum *res = make_bignum_from_mpz (mpz);
|
||||
SCM ret;
|
||||
if (mpz_fits_slong_p (mpz))
|
||||
ret = long_to_scm (mpz_get_si (mpz));
|
||||
else
|
||||
ret = scm_from_bignum (make_bignum_from_mpz (mpz));
|
||||
mpz_clear (mpz);
|
||||
return normalize_bignum (res);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue