ruby-changes:29551
From: akr <ko1@a...>
Date: Mon, 24 Jun 2013 23:32:02 +0900 (JST)
Subject: [ruby-changes:29551] akr:r41603 (trunk): * bignum.c (integer_unpack_single_bdigit): Refine code to filling
akr 2013-06-24 23:31:49 +0900 (Mon, 24 Jun 2013) New Revision: 41603 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41603 Log: * bignum.c (integer_unpack_single_bdigit): Refine code to filling higher bits and use BIGLO. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41602) +++ ChangeLog (revision 41603) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jun 24 23:30:31 2013 Tanaka Akira <akr@f...> + + * 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@g...> * test/rinda/test_rinda.rb (RingIPv6#prepare_ipv6): Index: bignum.c =================================================================== --- bignum.c (revision 41602) +++ bignum.c (revision 41603) @@ -1350,8 +1350,10 @@ integer_unpack_single_bdigit(BDIGIT u, s https://github.com/ruby/ruby/blob/trunk/bignum.c#L1350 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/