* include/ruby/ruby.h (INT2NUM): just use a simple macro on LP64.

(UINT2NUM): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-08-21 20:30:06 +00:00
parent f61354c405
commit 93ee8dea67
2 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,8 @@
Fri Aug 22 05:29:17 2008 Tanaka Akira <akr@fsij.org>
* include/ruby/ruby.h (INT2NUM): just use a simple macro on LP64.
(UINT2NUM): ditto.
Fri Aug 22 05:10:07 2008 Tanaka Akira <akr@fsij.org>
* io.c (rb_file_open_generic): take filename as a VALUE.

View File

@ -451,30 +451,35 @@ double rb_num2dbl(VALUE);
VALUE rb_uint2big(VALUE);
VALUE rb_int2big(SIGNED_VALUE);
#if SIZEOF_INT < SIZEOF_VALUE
# define INT2NUM(v) INT2FIX((int)(v))
# define UINT2NUM(v) LONG2FIX((unsigned int)(v))
#else
static inline VALUE
INT2NUM(int v)
{
# if SIZEOF_VALUE <= SIZEOF_INT
if (!FIXABLE(v))
return rb_int2big(v);
# endif
return INT2FIX(v);
}
static inline VALUE
UINT2NUM(unsigned int v)
{
if (!POSFIXABLE(v))
return rb_uint2big(v);
return LONG2FIX(v);
}
#endif
static inline VALUE
LONG2NUM(long v)
{
if (FIXABLE(v)) return LONG2FIX(v);
return rb_int2big(v);
}
static inline VALUE
UINT2NUM(unsigned int v)
{
# if SIZEOF_VALUE <= SIZEOF_INT
if (!POSFIXABLE(v))
return rb_uint2big(v);
# endif
return LONG2FIX(v);
}
static inline VALUE
ULONG2NUM(unsigned long v)
{