зеркало из https://github.com/github/ruby.git
numeric.c: adjust indent [ci skip]
* numeric.c (rb_num2ulong_internal): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
5dc2472024
Коммит
22e41718a4
23
numeric.c
23
numeric.c
|
@ -2666,18 +2666,17 @@ rb_num2ulong_internal(VALUE val, int *wrap_p)
|
|||
return (unsigned long)l;
|
||||
}
|
||||
else if (RB_TYPE_P(val, T_FLOAT)) {
|
||||
if (RFLOAT_VALUE(val) < ULONG_MAX_PLUS_ONE
|
||||
&& LONG_MIN_MINUS_ONE_IS_LESS_THAN(RFLOAT_VALUE(val))) {
|
||||
double d = RFLOAT_VALUE(val);
|
||||
if (wrap_p)
|
||||
*wrap_p = d <= -1.0; /* NUM2ULONG(v) uses v.to_int conceptually. */
|
||||
if (0 <= d)
|
||||
return (unsigned long)d;
|
||||
return (unsigned long)(long)d;
|
||||
}
|
||||
else {
|
||||
FLOAT_OUT_OF_RANGE(val, "integer");
|
||||
}
|
||||
double d = RFLOAT_VALUE(val);
|
||||
if (d < ULONG_MAX_PLUS_ONE && LONG_MIN_MINUS_ONE_IS_LESS_THAN(d)) {
|
||||
if (wrap_p)
|
||||
*wrap_p = d <= -1.0; /* NUM2ULONG(v) uses v.to_int conceptually. */
|
||||
if (0 <= d)
|
||||
return (unsigned long)d;
|
||||
return (unsigned long)(long)d;
|
||||
}
|
||||
else {
|
||||
FLOAT_OUT_OF_RANGE(val, "integer");
|
||||
}
|
||||
}
|
||||
else if (RB_TYPE_P(val, T_BIGNUM)) {
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче