diff options
author | Michael Livshin <mlivshin@bigfoot.com> | 2001-09-01 17:17:50 +0000 |
---|---|---|
committer | Michael Livshin <mlivshin@bigfoot.com> | 2001-09-01 17:17:50 +0000 |
commit | b10586f098fd7d0303bc605de35af1ec4da68a29 (patch) | |
tree | f9defe29b618dff881cafbeae4619bac4da7091f /libguile/num2integral.i.c | |
parent | 6f84677a95883a0301978b51a7fb4d8c5f362f8d (diff) | |
download | guile-b10586f098fd7d0303bc605de35af1ec4da68a29.tar.gz |
* numbers.c (scm_sys_check_number_conversions): new function,
defined if Guile is compiled in debugging mode. currently checks
`scm_num2ulong', should check much much more.
* num2integral.i.c (NUM2INTEGRAL): when converting a bignum to
unsigned, ensure that it's positive. thanks to Martin Baulig!
Diffstat (limited to 'libguile/num2integral.i.c')
-rw-r--r-- | libguile/num2integral.i.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libguile/num2integral.i.c b/libguile/num2integral.i.c index e0982bac3..65afa2603 100644 --- a/libguile/num2integral.i.c +++ b/libguile/num2integral.i.c @@ -47,8 +47,10 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller) res = new; } -#ifndef UNSIGNED if (SCM_BIGSIGN (num)) +#ifdef UNSIGNED + scm_out_of_range (s_caller, num); +#else { res = -res; if (res <= 0) @@ -56,6 +58,7 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller) else scm_out_of_range (s_caller, num); } +#endif else { if (res >= 0) @@ -63,8 +66,7 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller) else scm_out_of_range (s_caller, num); } -#endif - + return res; } else if (SCM_REALP (num)) |