ruby-changes:30676
From: akr <ko1@a...>
Date: Sun, 1 Sep 2013 13:03:42 +0900 (JST)
Subject: [ruby-changes:30676] akr:r42755 (trunk): * bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion,
akr 2013-09-01 13:03:32 +0900 (Sun, 01 Sep 2013) New Revision: 42755 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42755 Log: * bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion, SIZEOF_BDIGITS <= sizeof(BDIGIT) is enough. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42754) +++ ChangeLog (revision 42755) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Sep 1 13:02:24 2013 Tanaka Akira <akr@f...> + + * bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion, + SIZEOF_BDIGITS <= sizeof(BDIGIT) is enough. + Sun Sep 1 11:38:26 2013 Tanaka Akira <akr@f...> * bignum.c (maxpow_in_bdigit): Removed. Index: bignum.c =================================================================== --- bignum.c (revision 42754) +++ bignum.c (revision 42755) @@ -64,7 +64,7 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdi https://github.com/ruby/ruby/blob/trunk/bignum.c#L64 # define HOST_BIGENDIAN_P 0 #endif #define ALIGNOF(type) ((int)offsetof(struct { char f1; type f2; }, f2)) -/* (sizeof(d) * CHAR_BIT <= (n) ? 0 : (n)) is same as n but suppress a warning, C4293, by Visual Studio. */ +/* (!LSHIFTABLE(d, n) ? 0 : (n)) is same as n but suppress a warning, C4293, by Visual Studio. */ #define LSHIFTABLE(d, n) ((n) < sizeof(d) * CHAR_BIT) #define LSHIFTX(d, n) (!LSHIFTABLE(d, n) ? 0 : ((d) << (!LSHIFTABLE(d, n) ? 0 : (n)))) #define CLEAR_LOWBITS(d, numbits) ((d) & LSHIFTX(~((d)*0), (numbits))) @@ -73,9 +73,6 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdi https://github.com/ruby/ruby/blob/trunk/bignum.c#L73 #define BDIGITS(x) (RBIGNUM_DIGITS(x)) #define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT) -#if BITSPERDIG >= INT_MAX -# error incredible BDIGIT -#endif #define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG) #define BIGRAD_HALF ((BDIGIT)(BIGRAD >> 1)) #define BDIGIT_MSB(d) (((d) & BIGRAD_HALF) != 0) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/