diff options
Diffstat (limited to 'libguile/num2integral.i.c')
-rw-r--r-- | libguile/num2integral.i.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libguile/num2integral.i.c b/libguile/num2integral.i.c index 61b1255c8..29e7effc0 100644 --- a/libguile/num2integral.i.c +++ b/libguile/num2integral.i.c @@ -35,6 +35,11 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller) ITYPE res = 0; size_t l; +#ifdef UNSIGNED + if (SCM_BIGSIGN (num)) + scm_out_of_range (s_caller, num); +#endif + for (l = SCM_NUMDIGS (num); l--;) { ITYPE new = SCM_I_BIGUP (ITYPE, res) + SCM_BDIGITS (num)[l]; @@ -47,10 +52,10 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller) res = new; } - if (SCM_BIGSIGN (num)) #ifdef UNSIGNED - scm_out_of_range (s_caller, num); + return res; #else + if (SCM_BIGSIGN (num)) { res = -res; if (res <= 0) @@ -58,7 +63,6 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller) else scm_out_of_range (s_caller, num); } -#endif else { if (res >= 0) @@ -66,8 +70,7 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller) else scm_out_of_range (s_caller, num); } - - return res; +#endif } else scm_wrong_type_arg (s_caller, pos, num); |