Hi,
In message "[ruby-talk:6464] Re: Is there a FITS_IN_UINT(v)?"
on 00/11/21, Dave Thomas <Dave / thomases.com> writes:
|Alternatively,
|
| if a is a Fixnum, then it fits
Not always, e.g. where sizeof(VALUE) == sizeof(long) > sizeof(int).
This case, you can define UINTABLE by using FIXNUM_P, NUM2LONG and
UINT_MAX.
| if a is a Bignum then
| it fits if a.size <= sizeof(int)
You have to define how to handle negative Bignums first. Since
Bignums have independent sign, -0xffff_ffff, for example, does not fit
in 32 bit integer.
matz.