diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-25 11:10:40 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-25 11:10:40 +0000 |
commit | d4f1cc32042789d24d698d7a09a4b8c5058c0526 (patch) | |
tree | b81ad071c1f326dade556000f8e3447f3cd9c0b9 | |
parent | e4e5bc118e8abe96ff352dac2c7c62f9094a6e70 (diff) | |
download | ruby-d4f1cc32042789d24d698d7a09a4b8c5058c0526.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | bignum.c | 9 |
2 files changed, 10 insertions, 5 deletions
@@ -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. @@ -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); |