aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-09-09 15:26:30 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-09-09 15:26:30 +0900
commit1dab9557432e12f489109966b8ab5c6cb85afba6 (patch)
treebf9dd9180cb58cffbedcd649bf2e83a914507fd0
parent4fec2e57f323dcbf6cc0e37c6a81907b52b1d851 (diff)
downloadruby-1dab9557432e12f489109966b8ab5c6cb85afba6.tar.gz
ruby.h: make rb_long2int() always an inline function
For less macro lines, and better argument type checking.
-rw-r--r--include/ruby/ruby.h15
1 files changed, 4 insertions, 11 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index ff1c463..60dbf79 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -300,24 +300,17 @@ VALUE rb_ull2inum(unsigned LONG_LONG);
# endif
#endif
-#if SIZEOF_INT < SIZEOF_VALUE
-NORETURN(void rb_out_of_int(SIGNED_VALUE num));
-#endif
-
-#if SIZEOF_INT < SIZEOF_LONG
static inline int
-rb_long2int_inline(long n)
+rb_long2int(long n)
{
int i = (int)n;
+#if SIZEOF_INT < SIZEOF_LONG
+ NORETURN(void rb_out_of_int(SIGNED_VALUE num));
if ((long)i != n)
rb_out_of_int(n);
-
+#endif
return i;
}
-#define rb_long2int(n) rb_long2int_inline(n)
-#else
-#define rb_long2int(n) ((int)(n))
-#endif
#ifndef PIDT2NUM
#define PIDT2NUM(v) LONG2NUM(v)