* bignum.c (big_lshift): make shift offset long type.
(big_rshift): ditto. (rb_big_lshift): ditto. (big_rshift): ditto. [ruby-dev:31434] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e7e1b3a2d6
commit
02c581be74
@ -1,3 +1,11 @@
|
|||||||
|
Thu Aug 16 13:06:08 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* bignum.c (big_lshift): make shift offset long type.
|
||||||
|
(big_rshift): ditto.
|
||||||
|
(rb_big_lshift): ditto.
|
||||||
|
(big_rshift): ditto.
|
||||||
|
[ruby-dev:31434]
|
||||||
|
|
||||||
Thu Aug 16 06:29:08 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Aug 16 06:29:08 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (argf_readpartial): argf_forward needs argc and argv.
|
* io.c (argf_readpartial): argf_forward needs argc and argv.
|
||||||
|
21
bignum.c
21
bignum.c
@ -1730,8 +1730,8 @@ bdigbitsize(BDIGIT x)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE big_lshift(VALUE, unsigned int);
|
static VALUE big_lshift(VALUE, unsigned long);
|
||||||
static VALUE big_rshift(VALUE, unsigned int);
|
static VALUE big_rshift(VALUE, unsigned long);
|
||||||
|
|
||||||
static VALUE big_shift(VALUE x, int n)
|
static VALUE big_shift(VALUE x, int n)
|
||||||
{
|
{
|
||||||
@ -2103,11 +2103,12 @@ check_shiftdown(VALUE y, VALUE x)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_big_lshift(VALUE x, VALUE y)
|
rb_big_lshift(VALUE x, VALUE y)
|
||||||
{
|
{
|
||||||
int shift, neg = 0;
|
long shift;
|
||||||
|
int neg = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (FIXNUM_P(y)) {
|
if (FIXNUM_P(y)) {
|
||||||
shift = FIX2INT(y);
|
shift = FIX2LONG(y);
|
||||||
if (shift < 0) {
|
if (shift < 0) {
|
||||||
neg = 1;
|
neg = 1;
|
||||||
shift = -shift;
|
shift = -shift;
|
||||||
@ -2131,10 +2132,10 @@ rb_big_lshift(VALUE x, VALUE y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
big_lshift(VALUE x, unsigned int shift)
|
big_lshift(VALUE x, unsigned long shift)
|
||||||
{
|
{
|
||||||
BDIGIT *xds, *zds;
|
BDIGIT *xds, *zds;
|
||||||
int s1 = shift/BITSPERDIG;
|
long s1 = shift/BITSPERDIG;
|
||||||
int s2 = shift%BITSPERDIG;
|
int s2 = shift%BITSPERDIG;
|
||||||
VALUE z;
|
VALUE z;
|
||||||
BDIGIT_DBL num = 0;
|
BDIGIT_DBL num = 0;
|
||||||
@ -2166,12 +2167,12 @@ big_lshift(VALUE x, unsigned int shift)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_big_rshift(VALUE x, VALUE y)
|
rb_big_rshift(VALUE x, VALUE y)
|
||||||
{
|
{
|
||||||
int shift;
|
long shift;
|
||||||
int neg = 0;
|
int neg = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (FIXNUM_P(y)) {
|
if (FIXNUM_P(y)) {
|
||||||
shift = FIX2INT(y);
|
shift = FIX2LONG(y);
|
||||||
if (shift < 0) {
|
if (shift < 0) {
|
||||||
neg = 1;
|
neg = 1;
|
||||||
shift = -shift;
|
shift = -shift;
|
||||||
@ -2197,11 +2198,11 @@ rb_big_rshift(VALUE x, VALUE y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
big_rshift(VALUE x, unsigned int shift)
|
big_rshift(VALUE x, unsigned long shift)
|
||||||
{
|
{
|
||||||
BDIGIT *xds, *zds;
|
BDIGIT *xds, *zds;
|
||||||
long s1 = shift/BITSPERDIG;
|
long s1 = shift/BITSPERDIG;
|
||||||
long s2 = shift%BITSPERDIG;
|
int s2 = shift%BITSPERDIG;
|
||||||
VALUE z;
|
VALUE z;
|
||||||
BDIGIT_DBL num = 0;
|
BDIGIT_DBL num = 0;
|
||||||
long i, j;
|
long i, j;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user