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

ruby-changes:29635

From: akr <ko1@a...>
Date: Fri, 28 Jun 2013 12:35:53 +0900 (JST)
Subject: [ruby-changes:29635] akr:r41687 (trunk): * bignum.c (rb_big_and): Allocate new bignum with same size to shorter

akr	2013-06-28 12:35:39 +0900 (Fri, 28 Jun 2013)

  New Revision: 41687

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

  Log:
    * bignum.c (rb_big_and): Allocate new bignum with same size to shorter
      argument if it's high bits are zero.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41686)
+++ ChangeLog	(revision 41687)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 28 12:26:53 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (rb_big_and): Allocate new bignum with same size to shorter
+	  argument if it's high bits are zero.
+
 Fri Jun 28 12:14:04 2013  Tanaka Akira  <akr@f...>
 
 	* ext/socket/ipsocket.c (init_inetsock_internal): Don't use local
Index: bignum.c
===================================================================
--- bignum.c	(revision 41686)
+++ bignum.c	(revision 41687)
@@ -4747,6 +4747,9 @@ rb_big_and(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4747
     hibits1 = hibitsx;
     hibits2 = hibitsy;
 
+    if (!hibits1)
+        l2 = l1;
+
     z = bignew(l2, 0);
     zds = BDIGITS(z);
 

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

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