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

ruby-changes:29569

From: akr <ko1@a...>
Date: Tue, 25 Jun 2013 20:10:54 +0900 (JST)
Subject: [ruby-changes:29569] akr:r41621 (trunk): * bignum.c (rb_big2ulong_pack): Use rb_integer_pack.

akr	2013-06-25 20:10:40 +0900 (Tue, 25 Jun 2013)

  New Revision: 41621

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

  Log:
    * bignum.c (rb_big2ulong_pack): Use rb_integer_pack.
      (rb_big_aref): Call big2ulong with TRUE for "check" argument.
      It should be non-effective.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41620)
+++ ChangeLog	(revision 41621)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jun 25 20:08:29 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (rb_big2ulong_pack): Use rb_integer_pack.
+	  (rb_big_aref): Call big2ulong with TRUE for "check" argument.
+	  It should be non-effective.
+
 Tue Jun 25 19:07:33 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (LSHIFTX): Revert r41611.
Index: bignum.c
===================================================================
--- bignum.c	(revision 41620)
+++ bignum.c	(revision 41621)
@@ -2438,10 +2438,9 @@ big2ulong(VALUE x, const char *type, int https://github.com/ruby/ruby/blob/trunk/bignum.c#L2438
 VALUE
 rb_big2ulong_pack(VALUE x)
 {
-    unsigned long num = big2ulong(x, "unsigned long", FALSE);
-    if (!RBIGNUM_SIGN(x)) {
-	return (VALUE)(-(SIGNED_VALUE)num);
-    }
+    unsigned long num;
+    rb_integer_pack(x, &num, 1, sizeof(num), 0,
+        INTEGER_PACK_NATIVE_BYTE_ORDER|INTEGER_PACK_2COMP);
     return num;
 }
 
@@ -5068,7 +5067,7 @@ rb_big_aref(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L5067
 	  out_of_range:
 	    return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
 	}
-	shift = big2ulong(y, "long", FALSE);
+	shift = big2ulong(y, "long", TRUE);
     }
     else {
 	i = NUM2LONG(y);

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

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