mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (rb_big2ulong): need to calc in unsigned long, because
the range of VALUE is larger than it on LLP64 platform, such as Win64. this change fixes the failures of test/-ext-/num2int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2a44594508
commit
4a997526e0
2 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Wed Nov 16 13:51:40 2011 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* bignum.c (rb_big2ulong): need to calc in unsigned long, because
|
||||||
|
the range of VALUE is larger than it on LLP64 platform, such as Win64.
|
||||||
|
this change fixes the failures of test/-ext-/num2int.
|
||||||
|
|
||||||
Wed Nov 16 12:02:47 2011 NAKAMURA Usaku <usa@ruby-lang.org>
|
Wed Nov 16 12:02:47 2011 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* test/webrick/test_cgi.rb (TestWEBrickCGI#start_cgi_server): there are
|
* test/webrick/test_cgi.rb (TestWEBrickCGI#start_cgi_server): there are
|
||||||
|
|
4
bignum.c
4
bignum.c
|
@ -1210,11 +1210,11 @@ rb_big2ulong(VALUE x)
|
||||||
VALUE num = big2ulong(x, "unsigned long", TRUE);
|
VALUE num = big2ulong(x, "unsigned long", TRUE);
|
||||||
|
|
||||||
if (!RBIGNUM_SIGN(x)) {
|
if (!RBIGNUM_SIGN(x)) {
|
||||||
VALUE v = (VALUE)(-(SIGNED_VALUE)num);
|
unsigned long v = (unsigned long)(-(long)num);
|
||||||
|
|
||||||
if (v <= LONG_MAX)
|
if (v <= LONG_MAX)
|
||||||
rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
|
rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
|
||||||
return v;
|
return (VALUE)v;
|
||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue