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

* num2integral.i.c (NUM2INTEGRAL): Fixed signedness problem.

This commit is contained in:
Dirk Herrmann 2002-02-25 22:48:21 +00:00
parent 4f2716b6f6
commit bac0e23263
2 changed files with 21 additions and 13 deletions

View file

@ -1,3 +1,7 @@
2002-01-10 Dirk Herrmann <D.Herrmann@tu-bs.de>
* num2integral.i.c (NUM2INTEGRAL): Fixed signedness problem.
2002-02-25 Gary Houston <ghouston@arglist.com> 2002-02-25 Gary Houston <ghouston@arglist.com>
* convert.c: include <string.h> for convert_i.c. * convert.c: include <string.h> for convert_i.c.

View file

@ -27,17 +27,21 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
scm_out_of_range (s_caller, num); scm_out_of_range (s_caller, num);
#endif #endif
if (sizeof (ITYPE) >= sizeof (scm_t_signed_bits)) #if SIZEOF_ITYPE >= SIZEOF_SCM_T_BITS
/* can't fit anything too big for this type in an inum /* the target type is large enough to hold any possible inum */
anyway */ return (ITYPE) n;
return (ITYPE) n; #else
else /* an inum can be out of range, so check */
{ /* an inum can be out of range, so check */ #ifdef UNSIGNED
if (((ITYPE)n) != n) /* n is known to be >= 0 */
scm_out_of_range (s_caller, num); if ((scm_t_bits) n > UNSIGNED_ITYPE_MAX)
else scm_out_of_range (s_caller, num);
return (ITYPE) n; #else
} if (((ITYPE)n) != n)
scm_out_of_range (s_caller, num);
#endif
return (ITYPE) n;
#endif /* SIZEOF_ITYPE >= SIZEOF_SCM_T_BITS */
} }
else if (SCM_BIGP (num)) else if (SCM_BIGP (num))
{ /* bignum */ { /* bignum */
@ -80,7 +84,7 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
#endif #endif
#else /* SIZEOF_ITYPE >= SIZEOF_SCM_T_BITS */ #else /* SIZEOF_ITYPE >= SIZEOF_SCM_T_BITS */
scm_out_of_range (s_caller, num); scm_out_of_range (s_caller, num);
#endif #endif
} }