ruby-changes:29818
From: akr <ko1@a...>
Date: Wed, 10 Jul 2013 00:44:53 +0900 (JST)
Subject: [ruby-changes:29818] akr:r41869 (trunk): * bignum.c (bary_mul): x*1 is x.
akr 2013-07-10 00:43:48 +0900 (Wed, 10 Jul 2013) New Revision: 41869 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41869 Log: * bignum.c (bary_mul): x*1 is x. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41868) +++ ChangeLog (revision 41869) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jul 10 00:41:42 2013 Tanaka Akira <akr@f...> + + * bignum.c (bary_mul): x*1 is x. + Tue Jul 9 22:24:39 2013 Tanaka Akira <akr@f...> * bignum.c (bary_mul1): No need to invoke MEMZERO at last. Index: bignum.c =================================================================== --- bignum.c (revision 41868) +++ bignum.c (revision 41869) @@ -1856,6 +1856,17 @@ bary_mul(BDIGIT *zds, size_t zl, BDIGIT https://github.com/ruby/ruby/blob/trunk/bignum.c#L1856 return; } + if (xl == 1 && xds[0] == 1) { + MEMCPY(zds, yds, BDIGIT, yl); + MEMZERO(zds + yl, BDIGIT, zl - yl); + return; + } + if (yl == 1 && yds[0] == 1) { + MEMCPY(zds, xds, BDIGIT, xl); + MEMZERO(zds + xl, BDIGIT, zl - xl); + return; + } + /* normal multiplication when x is small */ if (xl < KARATSUBA_MUL_DIGITS) { normal: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/