mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* numeric.c (check_uint): fix wrong message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2513550e28
commit
dbd68031e0
1 changed files with 2 additions and 8 deletions
10
numeric.c
10
numeric.c
|
@ -1588,23 +1588,17 @@ static void
|
|||
check_uint(VALUE num, VALUE sign)
|
||||
{
|
||||
static const VALUE mask = ~(VALUE)UINT_MAX;
|
||||
const char *s;
|
||||
|
||||
if (RTEST(sign)) {
|
||||
/* minus */
|
||||
if ((num & mask) != mask || (num & ~mask) <= INT_MAX + 1UL)
|
||||
s = "small";
|
||||
else
|
||||
return;
|
||||
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too small to convert to `unsigned int'", num);
|
||||
}
|
||||
else {
|
||||
/* plus */
|
||||
if ((num & mask) != 0)
|
||||
s = "big";
|
||||
else
|
||||
return;
|
||||
rb_raise(rb_eRangeError, "integer %"PRIuVALUE " too big to convert to `unsigned int'", num);
|
||||
}
|
||||
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too %s to convert to `unsigned int'", num, s);
|
||||
}
|
||||
|
||||
long
|
||||
|
|
Loading…
Add table
Reference in a new issue