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

ruby-changes:29383

From: akr <ko1@a...>
Date: Wed, 19 Jun 2013 23:53:10 +0900 (JST)
Subject: [ruby-changes:29383] akr:r41435 (trunk): * bignum.c (bigfixize): Use rb_absint_size.

akr	2013-06-19 23:53:01 +0900 (Wed, 19 Jun 2013)

  New Revision: 41435

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

  Log:
    * bignum.c (bigfixize): Use rb_absint_size.
      (check_shiftdown): Ditto.
      (big2ulong): Use bdigit_roomof.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41434)
+++ ChangeLog	(revision 41435)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun 19 23:51:48 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (bigfixize): Use rb_absint_size.
+	  (check_shiftdown): Ditto.
+	  (big2ulong): Use bdigit_roomof.
+
 Wed Jun 19 23:32:23 2013  Koichi Sasada  <ko1@a...>
 
 	* gc.c (RVALUE_PROMOTED): check consistency between oldgen flag and
Index: bignum.c
===================================================================
--- bignum.c	(revision 41434)
+++ bignum.c	(revision 41435)
@@ -293,7 +293,7 @@ bigfixize(VALUE x) https://github.com/ruby/ruby/blob/trunk/bignum.c#L293
     BDIGIT *ds = BDIGITS(x);
 
     if (len == 0) return INT2FIX(0);
-    if ((size_t)(len*SIZEOF_BDIGITS) <= sizeof(long)) {
+    if (rb_absint_size(x, NULL) <= sizeof(long)) {
 	long num = 0;
 #if 2*SIZEOF_BDIGITS > SIZEOF_LONG
 	num = (long)ds[0];
@@ -2256,7 +2256,7 @@ big2ulong(VALUE x, const char *type, int https://github.com/ruby/ruby/blob/trunk/bignum.c#L2256
     if (rb_absint_size(x, NULL) > sizeof(long)) {
 	if (check)
 	    rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
-	len = sizeof(long)/SIZEOF_BDIGITS;
+	len = bdigit_roomof(sizeof(long));
     }
     ds = BDIGITS(x);
     num = 0;
@@ -4684,7 +4684,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/bignum.c#L4684
 check_shiftdown(VALUE y, VALUE x)
 {
     if (!RBIGNUM_LEN(x)) return INT2FIX(0);
-    if (RBIGNUM_LEN(y) > SIZEOF_LONG / SIZEOF_BDIGITS) {
+    if (rb_absint_size(y, NULL) > SIZEOF_LONG) {
 	return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(-1);
     }
     return Qnil;

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

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