ruby-changes:11909
From: nobu <ko1@a...>
Date: Tue, 26 May 2009 05:38:25 +0900 (JST)
Subject: [ruby-changes:11909] Ruby:r23570 (trunk): * include/ruby/ruby.h (NUM2LONG): added GCC specific optimization.
nobu 2009-05-26 05:38:06 +0900 (Tue, 26 May 2009) New Revision: 23570 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23570 Log: * include/ruby/ruby.h (NUM2LONG): added GCC specific optimization. Modified files: trunk/ChangeLog trunk/include/ruby/ruby.h Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 23569) +++ include/ruby/ruby.h (revision 23570) @@ -433,11 +433,17 @@ 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 @@ 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;} Index: ChangeLog =================================================================== --- ChangeLog (revision 23569) +++ ChangeLog (revision 23570) @@ -1,3 +1,7 @@ +Tue May 26 05:38:03 2009 Nobuyoshi Nakada <nobu@r...> + + * include/ruby/ruby.h (NUM2LONG): added GCC specific optimization. + Tue May 26 03:41:29 2009 Nobuyoshi Nakada <nobu@r...> * time.c (rb_gmtime, rb_localtime): gmtime and localtime return -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/