summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby')
-rw-r--r--include/ruby/ruby.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index da4c48f447..c3696ff866 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -171,6 +171,14 @@ VALUE rb_ull2inum(unsigned LONG_LONG);
# define OFFT2NUM(v) INT2NUM(v)
#endif
+#if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
+# define SIZET2NUM(v) ULL2NUM(v)
+#elif SIZEOF_SIZE_T == SIZEOF_LONG
+# define SIZET2NUM(v) ULONG2NUM(v)
+#else
+# define SIZET2NUM(v) UINT2NUM(v)
+#endif
+
#ifndef PIDT2NUM
#define PIDT2NUM(v) LONG2NUM(v)
#endif
@@ -364,6 +372,12 @@ unsigned LONG_LONG rb_num2ull(VALUE);
# define NUM2OFFT(x) NUM2LONG(x)
#endif
+#if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG
+# define NUM2SIZET(x) ((size_t)NUM2ULL(x))
+#else
+# define NUM2SIZET(x) NUM2ULONG(x)
+#endif
+
double rb_num2dbl(VALUE);
#define NUM2DBL(x) rb_num2dbl((VALUE)(x))