diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-10-07 15:49:00 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-10-07 15:49:00 +0000 |
| commit | 3c96b01b763d895a2404f3acb505172f224b22cf (patch) | |
| tree | ca1029b5126291ed2d7e229b83c3e5bb047cf999 | |
| parent | a80fd6234c63ec2001e0368f89b6f894791bf741 (diff) | |
| download | ruby-3c96b01b763d895a2404f3acb505172f224b22cf.tar.gz ruby-3c96b01b763d895a2404f3acb505172f224b22cf.tar.xz ruby-3c96b01b763d895a2404f3acb505172f224b22cf.zip | |
* bignum.c (rb_big_rshift): a bug in right shift of negative
bignums. [ruby-core:09020]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@11104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | bignum.c | 4 |
2 files changed, 9 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sat Oct 7 23:44:33 2006 Yukihiro Matsumoto <matz@ruby-lang.org> + + * bignum.c (rb_big_rshift): a bug in right shift of negative + bignums. [ruby-core:09020] + Sat Oct 7 00:27:58 2006 Yukihiro Matsumoto <matz@ruby-lang.org> * class.c (rb_include_module): remove unnecessary check. @@ -1885,6 +1885,10 @@ rb_big_rshift(x, y) } xds = BDIGITS(x); i = RBIGNUM(x)->len; j = i - s1; + if (j == 0) { + if (RBIGNUM(x)->sign) return INT2FIX(0); + else return INT2FIX(-1); + } z = bignew(j, RBIGNUM(x)->sign); if (!RBIGNUM(x)->sign) { num = ((BDIGIT_DBL)~0) << BITSPERDIG; |
