diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-25 20:38:06 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-25 20:38:06 +0000 |
commit | 6e685627c7c30a22c6b4cfc9fe1dbe6fc422a8e3 (patch) | |
tree | 63005350348133ac121724d64c1f197b58a334e8 /include/ruby/ruby.h | |
parent | f17f98370e292c10925f27476e2de5671cea8bdd (diff) | |
download | ruby-6e685627c7c30a22c6b4cfc9fe1dbe6fc422a8e3.tar.gz ruby-6e685627c7c30a22c6b4cfc9fe1dbe6fc422a8e3.tar.xz ruby-6e685627c7c30a22c6b4cfc9fe1dbe6fc422a8e3.zip |
* include/ruby/ruby.h (NUM2LONG): added GCC specific optimization.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby/ruby.h')
-rw-r--r-- | include/ruby/ruby.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 8e8486b10..54018ab27 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -433,11 +433,17 @@ void rb_set_errinfo(VALUE); SIGNED_VALUE rb_num2long(VALUE); VALUE rb_num2ulong(VALUE); +#define NUM2LONG_internal(x) (FIXNUM_P(x) ? FIX2LONG(x) : rb_num2long(x)) +#ifdef __GNUC__ +#define NUM2LONG(x) \ + __extension__ ({VALUE num2long_x = (x); NUM2LONG_internal(num2long_x);}) +#else static inline long NUM2LONG(VALUE x) { - return FIXNUM_P(x) ? FIX2LONG(x) : rb_num2long(x); + return NUM2LONG_internal(x); } +#endif #define NUM2ULONG(x) rb_num2ulong((VALUE)x) #if SIZEOF_INT < SIZEOF_LONG long rb_num2int(VALUE); @@ -672,7 +678,7 @@ NORETURN(void rb_out_of_int(SIGNED_VALUE num)); int i = (int)(n); \ if ((long)i != (n)) rb_out_of_int(n) #ifdef __GNUC__ -#define rb_long2int(i2l_n) ({rb_long2int_internal(i2l_n, i2l_i); i2l_i;}) +#define rb_long2int(i2l_n) __extension__ ({rb_long2int_internal(i2l_n, i2l_i); i2l_i;}) #else static inline int rb_long2int(long n) {rb_long2int_internal(n, i); return i;} |