* bignum.c (rb_big2ulong_pack): Use rb_integer_pack.

(rb_big_aref): Call big2ulong with TRUE for "check" argument.
  It should be non-effective.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-25 11:10:40 +00:00
parent e4e5bc118e
commit d4f1cc3204
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,9 @@
Tue Jun 25 20:08:29 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (rb_big2ulong_pack): Use rb_integer_pack.
(rb_big_aref): Call big2ulong with TRUE for "check" argument.
It should be non-effective.
Tue Jun 25 19:07:33 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (LSHIFTX): Revert r41611.

View File

@ -2438,10 +2438,9 @@ big2ulong(VALUE x, const char *type, int check)
VALUE
rb_big2ulong_pack(VALUE x)
{
unsigned long num = big2ulong(x, "unsigned long", FALSE);
if (!RBIGNUM_SIGN(x)) {
return (VALUE)(-(SIGNED_VALUE)num);
}
unsigned long num;
rb_integer_pack(x, &num, 1, sizeof(num), 0,
INTEGER_PACK_NATIVE_BYTE_ORDER|INTEGER_PACK_2COMP);
return num;
}
@ -5068,7 +5067,7 @@ rb_big_aref(VALUE x, VALUE y)
out_of_range:
return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
}
shift = big2ulong(y, "long", FALSE);
shift = big2ulong(y, "long", TRUE);
}
else {
i = NUM2LONG(y);