From 2d8612e9666a9fb0ddf240b2920dc4cf69632ad8 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 12 Oct 2010 08:56:00 +0000 Subject: [PATCH] * numeric (check_uint): the mask must refer to VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ numeric.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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 */