From afb03d16464599102b65b5d6da8622fa6e25ee1e Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 22 Jun 2013 00:56:53 +0000 Subject: [PATCH] * bignum.c (LSHIFTX): Defined to suppress a warning. (RSHIFTX): Ditto. (CLEAR_LOWBITS): Use LSHIFTX and RSHIFTX. (FILL_LOWBITS): Use LSHIFTX. Reported by ko1 via IRC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ bignum.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a69c04cab..d0b7e1e63c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Jun 22 09:55:13 2013 Tanaka Akira + + * bignum.c (LSHIFTX): Defined to suppress a warning. + (RSHIFTX): Ditto. + (CLEAR_LOWBITS): Use LSHIFTX and RSHIFTX. + (FILL_LOWBITS): Use LSHIFTX. + Reported by ko1 via IRC. + Sat Jun 22 09:11:33 2013 Ryan Davis * lib/minitest/*: Imported minitest 4.7.5 (r8724) diff --git a/bignum.c b/bignum.c index b580dee595..49af3016d7 100644 --- a/bignum.c +++ b/bignum.c @@ -39,8 +39,10 @@ static VALUE big_three = Qnil; # define HOST_BIGENDIAN_P 0 #endif #define ALIGNOF(type) ((int)offsetof(struct { char f1; type f2; }, f2)) -#define CLEAR_LOWBITS(d, numbits) (sizeof(d) * CHAR_BIT <= (numbits) ? 0 : ((d) >> (numbits)) << (numbits)) -#define FILL_LOWBITS(d, numbits) (sizeof(d) * CHAR_BIT <= (numbits) ? ~((d)*0) : (d) | ((((d)*0+1) << (numbits))-1)) +#define LSHIFTX(d, n) (sizeof(d) * CHAR_BIT <= (n) ? 0 : ((d) << (sizeof(d) * CHAR_BIT <= (n) ? 0 : (n)))) +#define RSHIFTX(d, n) (sizeof(d) * CHAR_BIT <= (n) ? ~((d)*0) : RSHIFT((d), (sizeof(d) * CHAR_BIT <= (n) ? 0 : (n)))) +#define CLEAR_LOWBITS(d, numbits) LSHIFTX(RSHIFTX((d), (numbits)), (numbits)) +#define FILL_LOWBITS(d, numbits) ((d) | (LSHIFTX(((d)*0+1), (numbits))-1)) #define BDIGITS(x) (RBIGNUM_DIGITS(x)) #define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)