diff --git a/ChangeLog b/ChangeLog index 29cf0c5716..850daf3d5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Oct 12 17:53:49 2010 NARUSE, Yui + + * numeric (check_uint): the mask must refer to VALUE. + Tue Oct 12 17:47:10 2010 NARUSE, Yui * numeric (check_uint): set MSB for negative value. diff --git a/numeric.c b/numeric.c index 9b01acfd10..65d501ae1e 100644 --- a/numeric.c +++ b/numeric.c @@ -1791,8 +1791,8 @@ check_uint(VALUE num, VALUE sign) if (RTEST(sign)) { /* minus */ if ((num & mask) != mask || (num & ~mask) <= INT_MAX + 1UL) -#define MSBMASK (1L << ((sizeof(long) * CHAR_BIT) - 1)) - rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too small to convert to `unsigned int'", num|MSBMASK); +#define VALUE_MSBMASK (1L << ((sizeof(VALUE) * CHAR_BIT) - 1)) + rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too small to convert to `unsigned int'", num|VALUE_MSBMASK); } else { /* plus */