bool
integer_to_ulong_p (SCHEME_OBJECT n)
{
- return ((FIXNUM_P (n)) || (BIGNUM_TO_ULONG_P (n)));
+ return ((FIXNUM_P (n)) ? (!FIXNUM_NEGATIVE_P (n)) : (BIGNUM_TO_ULONG_P (n)));
}
unsigned long
}
}
\f
-/* These procedures depend on the non-portable type `unsigned long'.
- If your compiler doesn't support this type, either define the
- switch `BIGNUM_NO_ULONG' to disable them (in "bignum.h"), or write
- new versions that don't use this type. */
-
-#ifndef BIGNUM_NO_ULONG
-
bignum_type
long_to_bignum (long n)
{
{
if (BIGNUM_ZERO_P (bignum))
return (0);
+ BIGNUM_ASSERT (BIGNUM_POSITIVE_P (bignum));
{
unsigned long accumulator = 0;
bignum_digit_type * start = (BIGNUM_START_PTR (bignum));
return (accumulator);
}
}
-
-#endif /* not BIGNUM_NO_ULONG */
\f
#define DTB_WRITE_DIGIT(n_bits) do \
{ \
bignum_fits_in_word_p (bignum_type bignum, long word_length,
int twos_complement_p)
{
- unsigned int n_bits = (twos_complement_p ? (word_length - 1) : word_length);
+ unsigned int n_bits;
+
+ if (twos_complement_p)
+ {
+ if (BIGNUM_NEGATIVE_P (bignum))
+ return (0);
+ n_bits = (word_length - 1);
+ }
+ else
+ n_bits = word_length;
+
BIGNUM_ASSERT (n_bits > 0);
{
bignum_length_type length = (BIGNUM_LENGTH (bignum));