mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (bary_mul): x*1 is x.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
55cbeefb2d
commit
5ec8b6e78e
2 changed files with 15 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Wed Jul 10 00:41:42 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* bignum.c (bary_mul): x*1 is x.
|
||||||
|
|
||||||
Tue Jul 9 22:24:39 2013 Tanaka Akira <akr@fsij.org>
|
Tue Jul 9 22:24:39 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* bignum.c (bary_mul1): No need to invoke MEMZERO at last.
|
* bignum.c (bary_mul1): No need to invoke MEMZERO at last.
|
||||||
|
|
11
bignum.c
11
bignum.c
|
@ -1856,6 +1856,17 @@ bary_mul(BDIGIT *zds, size_t zl, BDIGIT *xds, size_t xl, BDIGIT *yds, size_t yl,
|
||||||
return;
|
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 */
|
/* normal multiplication when x is small */
|
||||||
if (xl < KARATSUBA_MUL_DIGITS) {
|
if (xl < KARATSUBA_MUL_DIGITS) {
|
||||||
normal:
|
normal:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue