1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* bignum.c (bigfixize): Use rb_absint_size.

(check_shiftdown): Ditto.
  (big2ulong): Use bdigit_roomof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-19 14:53:01 +00:00
parent 745263abb9
commit 24c9860d55
2 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Wed Jun 19 23:51:48 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (bigfixize): Use rb_absint_size.
(check_shiftdown): Ditto.
(big2ulong): Use bdigit_roomof.
Wed Jun 19 23:32:23 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (RVALUE_PROMOTED): check consistency between oldgen flag and

View file

@ -293,7 +293,7 @@ bigfixize(VALUE x)
BDIGIT *ds = BDIGITS(x);
if (len == 0) return INT2FIX(0);
if ((size_t)(len*SIZEOF_BDIGITS) <= sizeof(long)) {
if (rb_absint_size(x, NULL) <= sizeof(long)) {
long num = 0;
#if 2*SIZEOF_BDIGITS > SIZEOF_LONG
num = (long)ds[0];
@ -2256,7 +2256,7 @@ big2ulong(VALUE x, const char *type, int check)
if (rb_absint_size(x, NULL) > sizeof(long)) {
if (check)
rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
len = sizeof(long)/SIZEOF_BDIGITS;
len = bdigit_roomof(sizeof(long));
}
ds = BDIGITS(x);
num = 0;
@ -4684,7 +4684,7 @@ static VALUE
check_shiftdown(VALUE y, VALUE x)
{
if (!RBIGNUM_LEN(x)) return INT2FIX(0);
if (RBIGNUM_LEN(y) > SIZEOF_LONG / SIZEOF_BDIGITS) {
if (rb_absint_size(y, NULL) > SIZEOF_LONG) {
return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(-1);
}
return Qnil;