1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
naruse 2010-10-12 08:56:00 +00:00
parent 232257238a
commit 2d8612e966
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Tue Oct 12 17:53:49 2010 NARUSE, Yui <naruse@ruby-lang.org>
* numeric (check_uint): the mask must refer to VALUE.
Tue Oct 12 17:47:10 2010 NARUSE, Yui <naruse@ruby-lang.org> Tue Oct 12 17:47:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
* numeric (check_uint): set MSB for negative value. * numeric (check_uint): set MSB for negative value.

View file

@ -1791,8 +1791,8 @@ check_uint(VALUE num, VALUE sign)
if (RTEST(sign)) { if (RTEST(sign)) {
/* minus */ /* minus */
if ((num & mask) != mask || (num & ~mask) <= INT_MAX + 1UL) if ((num & mask) != mask || (num & ~mask) <= INT_MAX + 1UL)
#define MSBMASK (1L << ((sizeof(long) * CHAR_BIT) - 1)) #define VALUE_MSBMASK (1L << ((sizeof(VALUE) * CHAR_BIT) - 1))
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too small to convert to `unsigned int'", num|MSBMASK); rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too small to convert to `unsigned int'", num|VALUE_MSBMASK);
} }
else { else {
/* plus */ /* plus */