diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-17 08:31:07 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-17 08:31:07 +0000 |
commit | 8c01a3765e2e76364d366d5aebf06477a4c0ad2d (patch) | |
tree | 1e75936d6190e83ca622543a5f79ab8d49545147 /bignum.c | |
parent | 859a9857156e19c54d9569a24387154d87ec5006 (diff) | |
download | ruby-8c01a3765e2e76364d366d5aebf06477a4c0ad2d.tar.gz |
* bignum.c (big_split): fix off-by-one error. [ruby-dev:39501]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1848,13 +1848,13 @@ big_split(VALUE v, long n, volatile VALUE *ph, volatile VALUE *pl) while (--hn && !vds[hn + ln]); h = bignew(hn += 2, 1); - MEMCPY(BDIGITS(h), vds + ln, BDIGIT, hn); - BDIGITS(h)[hn - 1] = 0; + MEMCPY(BDIGITS(h), vds + ln, BDIGIT, hn - 1); + BDIGITS(h)[hn - 1] = 0; /* margin for carry */ while (--ln && !vds[ln]); l = bignew(ln += 2, 1); - MEMCPY(BDIGITS(l), vds, BDIGIT, ln); - BDIGITS(l)[ln - 1] = 0; + MEMCPY(BDIGITS(l), vds, BDIGIT, ln - 1); + BDIGITS(l)[ln - 1] = 0; /* margin for carry */ *pl = l; *ph = h; |