* bignum.c (integer_unpack_single_bdigit): Refine code to filling

higher bits and use BIGLO.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-24 14:31:49 +00:00
parent 66ee8a1785
commit 13f1fbc09a
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Mon Jun 24 23:30:31 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (integer_unpack_single_bdigit): Refine code to filling
higher bits and use BIGLO.
Mon Jun 24 22:26:31 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
* test/rinda/test_rinda.rb (RingIPv6#prepare_ipv6):

View File

@ -1350,8 +1350,10 @@ integer_unpack_single_bdigit(BDIGIT u, size_t size, int flags, BDIGIT *dp)
sign = (flags & INTEGER_PACK_NEGATIVE) ?
((size == SIZEOF_BDIGITS && u == 0) ? -2 : -1) :
((u >> (size * CHAR_BIT - 1)) ? -1 : 1);
if (sign < 0)
u = (BDIGIT)(-(u | LSHIFTX((~(BDIGIT)0), size * CHAR_BIT)));
if (sign < 0) {
u |= LSHIFTX(BDIGMAX, size * CHAR_BIT);
u = BIGLO(-u);
}
}
else
sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1;