From f507c97380b1ac51d963b300f0b52e5edf329ff4 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 4 Jan 2022 13:59:46 +0100 Subject: [PATCH] positive?, negative? use integer lib * libguile/numbers.c (scm_positive_p, scm_negative_p): Use integer lib. --- libguile/numbers.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libguile/numbers.c b/libguile/numbers.c index 6aa944111..54d2f0a51 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -4974,11 +4974,7 @@ SCM_PRIMITIVE_GENERIC (scm_positive_p, "positive?", 1, 0, 0, if (SCM_I_INUMP (x)) return scm_from_bool (SCM_I_INUM (x) > 0); else if (SCM_BIGP (x)) - { - int sgn = mpz_sgn (SCM_I_BIG_MPZ (x)); - scm_remember_upto_here_1 (x); - return scm_from_bool (sgn > 0); - } + return scm_from_bool (scm_is_integer_positive_z (scm_bignum (x))); else if (SCM_REALP (x)) return scm_from_bool(SCM_REAL_VALUE (x) > 0.0); else if (SCM_FRACTIONP (x)) @@ -4998,11 +4994,7 @@ SCM_PRIMITIVE_GENERIC (scm_negative_p, "negative?", 1, 0, 0, if (SCM_I_INUMP (x)) return scm_from_bool (SCM_I_INUM (x) < 0); else if (SCM_BIGP (x)) - { - int sgn = mpz_sgn (SCM_I_BIG_MPZ (x)); - scm_remember_upto_here_1 (x); - return scm_from_bool (sgn < 0); - } + return scm_from_bool (scm_is_integer_negative_z (scm_bignum (x))); else if (SCM_REALP (x)) return scm_from_bool(SCM_REAL_VALUE (x) < 0.0); else if (SCM_FRACTIONP (x))