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

ruby-changes:29570

From: akr <ko1@a...>
Date: Tue, 25 Jun 2013 21:20:09 +0900 (JST)
Subject: [ruby-changes:29570] akr:r41622 (trunk): * bignum.c (big2ulong): "check" argument removed.

akr	2013-06-25 21:19:58 +0900 (Tue, 25 Jun 2013)

  New Revision: 41622

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

  Log:
    * bignum.c (big2ulong): "check" argument removed.
      (rb_big2ulong): Follow above change.
      (rb_big2long): Ditto.
      (rb_big_rshift): Ditto.
      (rb_big_aref): Ditto.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41621)
+++ ChangeLog	(revision 41622)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jun 25 20:36:31 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (big2ulong): "check" argument removed.
+	  (rb_big2ulong): Follow above change.
+	  (rb_big2long): Ditto.
+	  (rb_big_rshift): Ditto.
+	  (rb_big_aref): Ditto.
+
 Tue Jun 25 20:08:29 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (rb_big2ulong_pack): Use rb_integer_pack.
Index: bignum.c
===================================================================
--- bignum.c	(revision 41621)
+++ bignum.c	(revision 41622)
@@ -2408,7 +2408,7 @@ rb_big_to_s(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/bignum.c#L2408
 }
 
 static unsigned long
-big2ulong(VALUE x, const char *type, int check)
+big2ulong(VALUE x, const char *type)
 {
     long len = RBIGNUM_LEN(x);
     unsigned long num;
@@ -2417,10 +2417,7 @@ big2ulong(VALUE x, const char *type, int https://github.com/ruby/ruby/blob/trunk/bignum.c#L2417
     if (len == 0)
         return 0;
     if (BIGSIZE(x) > sizeof(long)) {
-	if (check)
-	    rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
-        if (bdigit_roomof(sizeof(long)) < len)
-            len = bdigit_roomof(sizeof(long));
+        rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
     }
     ds = BDIGITS(x);
 #if SIZEOF_LONG <= SIZEOF_BDIGITS
@@ -2447,7 +2444,7 @@ rb_big2ulong_pack(VALUE x) https://github.com/ruby/ruby/blob/trunk/bignum.c#L2444
 VALUE
 rb_big2ulong(VALUE x)
 {
-    unsigned long num = big2ulong(x, "unsigned long", TRUE);
+    unsigned long num = big2ulong(x, "unsigned long");
 
     if (RBIGNUM_POSITIVE_P(x)) {
         return num;
@@ -2464,7 +2461,7 @@ rb_big2ulong(VALUE x) https://github.com/ruby/ruby/blob/trunk/bignum.c#L2461
 SIGNED_VALUE
 rb_big2long(VALUE x)
 {
-    unsigned long num = big2ulong(x, "long", TRUE);
+    unsigned long num = big2ulong(x, "long");
 
     if (RBIGNUM_POSITIVE_P(x)) {
         if (num <= LONG_MAX)
@@ -4892,7 +4889,7 @@ rb_big_lshift(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4889
 		if (!NIL_P(t)) return t;
 		neg = 1;
 	    }
-	    shift = big2ulong(y, "long", TRUE);
+	    shift = big2ulong(y, "long");
 	    break;
 	}
 	y = rb_to_int(y);
@@ -4969,7 +4966,7 @@ rb_big_rshift(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4966
 	    else {
 		neg = 1;
 	    }
-	    shift = big2ulong(y, "long", TRUE);
+	    shift = big2ulong(y, "long");
 	    break;
 	}
 	y = rb_to_int(y);
@@ -5067,7 +5064,7 @@ rb_big_aref(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L5064
 	  out_of_range:
 	    return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
 	}
-	shift = big2ulong(y, "long", TRUE);
+	shift = big2ulong(y, "long");
     }
     else {
 	i = NUM2LONG(y);

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

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