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)