From e068834b5c38025c8633e5c72b57afcfd9dd4d56 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 15 Jul 2013 02:11:15 +0000 Subject: [PATCH] bignum.c: suppress warnings * bignum.c (big_shift2, rb_big_lshift, rb_big_rshift): cast explicitly to suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bignum.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bignum.c b/bignum.c index ca98c44837..d9120f8e61 100644 --- a/bignum.c +++ b/bignum.c @@ -62,6 +62,9 @@ STATIC_ASSERT(rbignum_embed_len_max, RBIGNUM_EMBED_LEN_MAX <= (RBIGNUM_EMBED_LEN #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) @@ -3308,7 +3311,7 @@ big_shift2(VALUE x, int lshift_p, VALUE y) if (1 < sign || CHAR_BIT <= lens[1]) return RBIGNUM_POSITIVE_P(x) ? INT2FIX(0) : INT2FIX(-1); } - shift_numbits = lens[0] & (BITSPERDIG-1); + shift_numbits = (int)(lens[0] & (BITSPERDIG-1)); shift_numdigits = (lens[0] >> bitsize(BITSPERDIG-1)) | (lens[1] << (CHAR_BIT*SIZEOF_SIZE_T - bitsize(BITSPERDIG-1))); return big_shift3(x, lshift_p, shift_numdigits, shift_numbits); @@ -5770,7 +5773,7 @@ rb_big_lshift(VALUE x, VALUE y) lshift_p = 0; shift = 1+(unsigned long)(-(l+1)); } - shift_numbits = shift & (BITSPERDIG-1); + shift_numbits = (int)(shift & (BITSPERDIG-1)); shift_numdigits = shift >> bitsize(BITSPERDIG-1); return bignorm(big_shift3(x, lshift_p, shift_numdigits, shift_numbits)); } @@ -5808,7 +5811,7 @@ rb_big_rshift(VALUE x, VALUE y) lshift_p = 1; shift = 1+(unsigned long)(-(l+1)); } - shift_numbits = shift & (BITSPERDIG-1); + shift_numbits = (int)(shift & (BITSPERDIG-1)); shift_numdigits = shift >> bitsize(BITSPERDIG-1); return bignorm(big_shift3(x, lshift_p, shift_numdigits, shift_numbits)); }