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

ruby-changes:32922

From: nobu <ko1@a...>
Date: Sun, 16 Feb 2014 16:20:28 +0900 (JST)
Subject: [ruby-changes:32922] nobu:r45001 (trunk): ruby.h: use FIX2LONG

nobu	2014-02-16 16:20:23 +0900 (Sun, 16 Feb 2014)

  New Revision: 45001

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45001

  Log:
    ruby.h: use FIX2LONG
    
    * include/ruby/ruby.h (RBIGNUM_SIGN): use FIX2LONG() instead of
      FIX2INT() for optimization, since rb_big_cmp() returns only
      Fixnum -1..+1 for Finxum 0.
    
      (RBIGNUM_POSITIVE_P, RBIGNUM_NEGATIVE_P): ditto.

  Modified files:
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 45000)
+++ include/ruby/ruby.h	(revision 45001)
@@ -1069,9 +1069,9 @@ struct RStruct { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1069
 #define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
 #define RSTRUCT_GET(st, idx)    (RSTRUCT_CONST_PTR(st)[idx])
 
-#define RBIGNUM_SIGN(b) (FIX2INT(rb_big_cmp((b), INT2FIX(0))) >= 0)
-#define RBIGNUM_POSITIVE_P(b) (FIX2INT(rb_big_cmp((b), INT2FIX(0))) >= 0)
-#define RBIGNUM_NEGATIVE_P(b) (FIX2INT(rb_big_cmp((b), INT2FIX(0))) < 0)
+#define RBIGNUM_SIGN(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) >= 0)
+#define RBIGNUM_POSITIVE_P(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) >= 0)
+#define RBIGNUM_NEGATIVE_P(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) < 0)
 
 #define R_CAST(st)   (struct st*)
 #define RBASIC(obj)  (R_CAST(RBasic)(obj))

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

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