+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>
* convert.c: include <string.h> for convert_i.c.
scm_out_of_range (s_caller, num);
#endif
- if (sizeof (ITYPE) >= sizeof (scm_t_signed_bits))
- /* can't fit anything too big for this type in an inum
- anyway */
- return (ITYPE) n;
- else
- { /* an inum can be out of range, so check */
- if (((ITYPE)n) != n)
- scm_out_of_range (s_caller, num);
- else
- return (ITYPE) n;
- }
+#if SIZEOF_ITYPE >= SIZEOF_SCM_T_BITS
+ /* the target type is large enough to hold any possible inum */
+ return (ITYPE) n;
+#else
+ /* an inum can be out of range, so check */
+#ifdef UNSIGNED
+ /* n is known to be >= 0 */
+ if ((scm_t_bits) n > UNSIGNED_ITYPE_MAX)
+ scm_out_of_range (s_caller, num);
+#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))
{ /* bignum */
scm_out_of_range (s_caller, num);
}
#endif
-
+
#else /* SIZEOF_ITYPE >= SIZEOF_SCM_T_BITS */
- scm_out_of_range (s_caller, num);
+ scm_out_of_range (s_caller, num);
#endif
}