summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-21 20:30:06 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-21 20:30:06 +0000
commit93ee8dea674b3935bf546665296bc328c124371f (patch)
tree6519db3475e409b0d8d8c1920248c739ec936d4b /include
parentf61354c40577276ebc6ef4dee9aadcaa3b59f97c (diff)
* 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
Diffstat (limited to 'include')
-rw-r--r--include/ruby/ruby.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 7c76691702..99453325b4 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -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
-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);
}
+#endif
+
+static inline VALUE
+LONG2NUM(long v)
+{
+ if (FIXABLE(v)) return LONG2FIX(v);
+ return rb_int2big(v);
+}
+
static inline VALUE
ULONG2NUM(unsigned long v)
{