1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion,

SIZEOF_BDIGITS <= sizeof(BDIGIT) is enough.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-09-01 04:03:32 +00:00
parent c9b3571ceb
commit 6fe40011a8
2 changed files with 6 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Sun Sep 1 13:02:24 2013 Tanaka Akira <akr@fsij.org>
* 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@fsij.org>
* bignum.c (maxpow_in_bdigit): Removed.

View file

@ -64,7 +64,7 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGITS % SIZEOF_LONG == 0);
# 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_bdigit, SIZEOF_BDIGITS % SIZEOF_LONG == 0);
#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)