* 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
10
numeric.c
10
numeric.c
@ -1588,23 +1588,17 @@ static void
|
|||||||
check_uint(VALUE num, VALUE sign)
|
check_uint(VALUE num, VALUE sign)
|
||||||
{
|
{
|
||||||
static const VALUE mask = ~(VALUE)UINT_MAX;
|
static const VALUE mask = ~(VALUE)UINT_MAX;
|
||||||
const char *s;
|
|
||||||
|
|
||||||
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)
|
||||||
s = "small";
|
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too small to convert to `unsigned int'", num);
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* plus */
|
/* plus */
|
||||||
if ((num & mask) != 0)
|
if ((num & mask) != 0)
|
||||||
s = "big";
|
rb_raise(rb_eRangeError, "integer %"PRIuVALUE " too big to convert to `unsigned int'", num);
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too %s to convert to `unsigned int'", num, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
|
Loading…
x
Reference in New Issue
Block a user