ruby-changes:29531
From: akr <ko1@a...>
Date: Sun, 23 Jun 2013 07:43:57 +0900 (JST)
Subject: [ruby-changes:29531] akr:r41583 (trunk): * bignum.c (bary_unpack_internal): Suppress warnings (C4146) on Visual Studio.
akr 2013-06-23 07:43:47 +0900 (Sun, 23 Jun 2013) New Revision: 41583 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41583 Log: * bignum.c (bary_unpack_internal): Suppress warnings (C4146) on Visual Studio. Reported by ko1 via IRC. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41582) +++ ChangeLog (revision 41583) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Jun 23 07:41:52 2013 Tanaka Akira <akr@f...> + + * bignum.c (bary_unpack_internal): Suppress warnings (C4146) on Visual Studio. + Reported by ko1 via IRC. + Sun Jun 23 06:49:28 2013 Koichi Sasada <ko1@a...> * include/ruby/ruby.h, gc.c: rename macros and functions: Index: bignum.c =================================================================== --- bignum.c (revision 41582) +++ bignum.c (revision 41583) @@ -1364,7 +1364,7 @@ bary_unpack_internal(BDIGIT *bdigits, si https://github.com/ruby/ruby/blob/trunk/bignum.c#L1364 sign = (flags & INTEGER_PACK_NEGATIVE) ? ((sizeof(uint8_t) == SIZEOF_BDIGITS && u == 0) ? -2 : -1) : ((u >> (sizeof(uint8_t) * CHAR_BIT - 1)) ? -1 : 1); - if (sign < 0) u = -(u | LSHIFTX((~(BDIGIT)0), sizeof(uint8_t) * CHAR_BIT)); + if (sign < 0) u = ((BDIGIT)0) - (u | LSHIFTX((~(BDIGIT)0), sizeof(uint8_t) * CHAR_BIT)); } else sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1; @@ -1379,7 +1379,7 @@ bary_unpack_internal(BDIGIT *bdigits, si https://github.com/ruby/ruby/blob/trunk/bignum.c#L1379 sign = (flags & INTEGER_PACK_NEGATIVE) ? ((sizeof(uint16_t) == SIZEOF_BDIGITS && u == 0) ? -2 : -1) : ((u >> (sizeof(uint16_t) * CHAR_BIT - 1)) ? -1 : 1); - if (sign < 0) u = -(u | LSHIFTX((~(BDIGIT)0), sizeof(uint16_t) * CHAR_BIT)); + if (sign < 0) u = ((BDIGIT)0) - (u | LSHIFTX((~(BDIGIT)0), sizeof(uint16_t) * CHAR_BIT)); } else sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1; @@ -1395,7 +1395,7 @@ bary_unpack_internal(BDIGIT *bdigits, si https://github.com/ruby/ruby/blob/trunk/bignum.c#L1395 sign = (flags & INTEGER_PACK_NEGATIVE) ? ((sizeof(uint32_t) == SIZEOF_BDIGITS && u == 0) ? -2 : -1) : ((u >> (sizeof(uint32_t) * CHAR_BIT - 1)) ? -1 : 1); - if (sign < 0) u = -(u | LSHIFTX((~(BDIGIT)0), sizeof(uint32_t) * CHAR_BIT)); + if (sign < 0) u = ((BDIGIT)0) - (u | LSHIFTX((~(BDIGIT)0), sizeof(uint32_t) * CHAR_BIT)); } else sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1; @@ -1411,7 +1411,7 @@ bary_unpack_internal(BDIGIT *bdigits, si https://github.com/ruby/ruby/blob/trunk/bignum.c#L1411 sign = (flags & INTEGER_PACK_NEGATIVE) ? ((sizeof(uint64_t) == SIZEOF_BDIGITS && u == 0) ? -2 : -1) : ((u >> (sizeof(uint64_t) * CHAR_BIT - 1)) ? -1 : 1); - if (sign < 0) u = -(u | LSHIFTX((~(BDIGIT)0), sizeof(uint64_t) * CHAR_BIT)); + if (sign < 0) u = ((BDIGIT)0) - (u | LSHIFTX((~(BDIGIT)0), sizeof(uint64_t) * CHAR_BIT)); } else sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/