[前][次][番号順一覧][スレッド一覧]

ruby-changes:45730

From: naruse <ko1@a...>
Date: Wed, 8 Mar 2017 02:47:00 +0900 (JST)
Subject: [ruby-changes:45730] naruse:r57803 (trunk): Avoid to cast the argument

naruse	2017-03-08 02:46:54 +0900 (Wed, 08 Mar 2017)

  New Revision: 57803

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57803

  Log:
    Avoid to cast the argument
    
    For 32bit environment and __int128 use cases.

  Modified files:
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 57802)
+++ include/ruby/ruby.h	(revision 57803)
@@ -360,7 +360,7 @@ rb_fix2ulong(VALUE x) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L360
 #define RB_POSFIXABLE(f) ((f) < RUBY_FIXNUM_MAX+1)
 #define RB_NEGFIXABLE(f) ((f) >= RUBY_FIXNUM_MIN)
 #if defined HAVE_BUILTIN___BUILTIN_ADD_OVERFLOW
-# define RB_FIXABLE(f) ({SIGNED_VALUE a=(f),c; !__builtin_add_overflow(a, a, &c);})
+# define RB_FIXABLE(f) ({SIGNED_VALUE c; !__builtin_add_overflow((f), (f), &c);})
 #else
 # define RB_FIXABLE(f) (RB_POSFIXABLE(f) && RB_NEGFIXABLE(f))
 #endif

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]