On Tue, 21 Nov 2000, Dave Thomas wrote:

> Can you compare against UINT_MAX from limits.h?
> 
> Alternatively,
> 
>   if a is a Fixnum, then it fits
> 
>   if a is a Bignum then
>      it fits if a.size <= sizeof(int)
> 
Your reply indicates that there is no such thing there already so I
settled for

#define UINTABLE(v) (FIXNUM_P(v) || ((T_BIGNUM==TYPE(v)) &&
(FIX2INT(rb_funcall(v,rb_intern("size"),0))<=sizeof(unsigned int)))

but note that it's not perfect since it will (in theory) fail for some
values (Quiz of the day: When will it fail? ;-)).

Thanks,

Robert