1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

(scm_quotient, scm_remainder): In inum/big, use mpz_cmp_ui

for big == abs(most-negative-fixnum) special case.
(abs_most_negative_fixnum): Remove, no longer used.
This commit is contained in:
Kevin Ryde 2004-04-05 22:48:05 +00:00
parent 2e1fc2e8e3
commit 4dc09ee4ff

View file

@ -148,7 +148,6 @@ xisnan (double x)
static SCM abs_most_negative_fixnum;
static mpz_t z_negative_one; static mpz_t z_negative_one;
@ -703,9 +702,13 @@ scm_quotient (SCM x, SCM y)
else if (SCM_BIGP (y)) else if (SCM_BIGP (y))
{ {
if ((SCM_INUM (x) == SCM_MOST_NEGATIVE_FIXNUM) if ((SCM_INUM (x) == SCM_MOST_NEGATIVE_FIXNUM)
&& (scm_i_bigcmp (abs_most_negative_fixnum, y) == 0)) && (mpz_cmp_ui (SCM_I_BIG_MPZ (y),
/* Special case: x == fixnum-min && y == abs (fixnum-min) */ - SCM_MOST_NEGATIVE_FIXNUM) == 0))
return SCM_MAKINUM (-1); {
/* Special case: x == fixnum-min && y == abs (fixnum-min) */
scm_remember_upto_here_1 (y);
return SCM_MAKINUM (-1);
}
else else
return SCM_MAKINUM (0); return SCM_MAKINUM (0);
} }
@ -779,9 +782,13 @@ scm_remainder (SCM x, SCM y)
else if (SCM_BIGP (y)) else if (SCM_BIGP (y))
{ {
if ((SCM_INUM (x) == SCM_MOST_NEGATIVE_FIXNUM) if ((SCM_INUM (x) == SCM_MOST_NEGATIVE_FIXNUM)
&& (scm_i_bigcmp (abs_most_negative_fixnum, y) == 0)) && (mpz_cmp_ui (SCM_I_BIG_MPZ (y),
/* Special case: x == fixnum-min && y == abs (fixnum-min) */ - SCM_MOST_NEGATIVE_FIXNUM) == 0))
return SCM_MAKINUM (0); {
/* Special case: x == fixnum-min && y == abs (fixnum-min) */
scm_remember_upto_here_1 (y);
return SCM_MAKINUM (0);
}
else else
return x; return x;
} }
@ -5690,9 +5697,6 @@ SCM_DEFINE (scm_sys_check_number_conversions, "%check-number-conversions", 0, 0,
void void
scm_init_numbers () scm_init_numbers ()
{ {
abs_most_negative_fixnum = scm_i_long2big (- SCM_MOST_NEGATIVE_FIXNUM);
scm_permanent_object (abs_most_negative_fixnum);
mpz_init_set_si (z_negative_one, -1); mpz_init_set_si (z_negative_one, -1);
/* It may be possible to tune the performance of some algorithms by using /* It may be possible to tune the performance of some algorithms by using