summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-16 00:19:51 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-16 00:19:51 +0000
commit9f6c62ad5f09ec1782442ec499cfd2a9962a3d2c (patch)
tree4fc9c08023e6946e41758e71e982ad59ae1d671c /bignum.c
parentd0b5d2016d5bf2d55291f7d8c121db8b028b2485 (diff)
* bignum.c (bary_small_rshift): Specify the higher BDIGIT instead of
sign bit. (big_shift3): Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/bignum.c b/bignum.c
index 73c7d33198..92b5b0b773 100644
--- a/bignum.c
+++ b/bignum.c
@@ -567,16 +567,14 @@ bary_small_lshift(BDIGIT *zds, const BDIGIT *xds, size_t n, int shift)
}
static void
-bary_small_rshift(BDIGIT *zds, const BDIGIT *xds, size_t n, int shift, int sign_bit)
+bary_small_rshift(BDIGIT *zds, const BDIGIT *xds, size_t n, int shift, BDIGIT higher_bdigit)
{
BDIGIT_DBL num = 0;
BDIGIT x;
assert(0 <= shift && shift < BITSPERDIG);
- if (sign_bit) {
- num = (~(BDIGIT_DBL)0) << BITSPERDIG;
- }
+ num = BIGUP(higher_bdigit);
while (n--) {
num = (num | xds[n]) >> shift;
x = xds[n];
@@ -4120,7 +4118,7 @@ big_shift3(VALUE x, int lshift_p, size_t shift_numdigits, int shift_numbits)
zn = xn - s1;
z = bignew(zn, 0);
zds = BDIGITS(z);
- bary_small_rshift(zds, xds+s1, zn, s2, hibitsx != 0);
+ bary_small_rshift(zds, xds+s1, zn, s2, hibitsx != 0 ? BDIGMAX : 0);
twocomp2abs_bang(z, hibitsx != 0);
}
RB_GC_GUARD(x);