From 1dab9557432e12f489109966b8ab5c6cb85afba6 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sat, 9 Sep 2017 15:26:30 +0900 Subject: ruby.h: make rb_long2int() always an inline function For less macro lines, and better argument type checking. --- include/ruby/ruby.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index ff1c463a29..60dbf79ec1 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) -- cgit v1.2.3