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

* numeric.c: fix indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-06-29 06:43:24 +00:00
parent 3d04e2e40f
commit f359740661

View file

@ -714,11 +714,11 @@ flo_divmod(VALUE x, VALUE y)
} }
flodivmod(RFLOAT(x)->value, fy, &div, &mod); flodivmod(RFLOAT(x)->value, fy, &div, &mod);
if (FIXABLE(div)) { if (FIXABLE(div)) {
val = div; val = div;
a = LONG2FIX(val); a = LONG2FIX(val);
} }
else { else {
a = rb_dbl2big(div); a = rb_dbl2big(div);
} }
b = rb_float_new(mod); b = rb_float_new(mod);
return rb_assoc_new(a, b); return rb_assoc_new(a, b);
@ -737,13 +737,13 @@ flo_pow(VALUE x, VALUE y)
{ {
switch (TYPE(y)) { switch (TYPE(y)) {
case T_FIXNUM: case T_FIXNUM:
return rb_float_new(pow(RFLOAT(x)->value, (double)FIX2LONG(y))); return rb_float_new(pow(RFLOAT(x)->value, (double)FIX2LONG(y)));
case T_BIGNUM: case T_BIGNUM:
return rb_float_new(pow(RFLOAT(x)->value, rb_big2dbl(y))); return rb_float_new(pow(RFLOAT(x)->value, rb_big2dbl(y)));
case T_FLOAT: case T_FLOAT:
return rb_float_new(pow(RFLOAT(x)->value, RFLOAT(y)->value)); return rb_float_new(pow(RFLOAT(x)->value, RFLOAT(y)->value));
default: default:
return rb_num_coerce_bin(x, y); return rb_num_coerce_bin(x, y);
} }
} }
@ -1577,7 +1577,7 @@ rb_fix2uint(VALUE val)
unsigned long num; unsigned long num;
if (!FIXNUM_P(val)) { if (!FIXNUM_P(val)) {
return rb_num2uint(val); return rb_num2uint(val);
} }
num = FIX2ULONG(val); num = FIX2ULONG(val);
if (FIX2LONG(val) > 0) { if (FIX2LONG(val) > 0) {
@ -1720,7 +1720,7 @@ static VALUE
int_odd_p(VALUE num) int_odd_p(VALUE num)
{ {
if (rb_funcall(num, '%', 1, INT2FIX(2)) != INT2FIX(0)) { if (rb_funcall(num, '%', 1, INT2FIX(2)) != INT2FIX(0)) {
return Qtrue; return Qtrue;
} }
return Qfalse; return Qfalse;
} }
@ -1736,7 +1736,7 @@ static VALUE
int_even_p(VALUE num) int_even_p(VALUE num)
{ {
if (rb_funcall(num, '%', 1, INT2FIX(2)) == INT2FIX(0)) { if (rb_funcall(num, '%', 1, INT2FIX(2)) == INT2FIX(0)) {
return Qtrue; return Qtrue;
} }
return Qfalse; return Qfalse;
} }
@ -2052,7 +2052,7 @@ fix_mul(VALUE x, VALUE y)
if (FIXNUM_P(y)) { if (FIXNUM_P(y)) {
#ifdef __HP_cc #ifdef __HP_cc
/* avoids an optimization bug of HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] */ /* avoids an optimization bug of HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] */
volatile volatile
#endif #endif
SIGNED_VALUE a, b; SIGNED_VALUE a, b;
#if SIZEOF_VALUE * 2 <= SIZEOF_LONG_LONG #if SIZEOF_VALUE * 2 <= SIZEOF_LONG_LONG
@ -2868,31 +2868,31 @@ VALUE yarv_invoke_Integer_times_special_block(VALUE);
static VALUE static VALUE
int_dotimes(VALUE num) int_dotimes(VALUE num)
{ {
VALUE val; VALUE val;
RETURN_ENUMERATOR(num, 0, 0); RETURN_ENUMERATOR(num, 0, 0);
if((val = yarv_invoke_Integer_times_special_block(num)) != Qundef){ if((val = yarv_invoke_Integer_times_special_block(num)) != Qundef){
return val; return val;
}
if (FIXNUM_P(num)) {
long i, end;
end = FIX2LONG(num);
for (i=0; i<end; i++) {
rb_yield(LONG2FIX(i));
} }
}
else {
VALUE i = INT2FIX(0);
for (;;) { if (FIXNUM_P(num)) {
if (!RTEST(rb_funcall(i, '<', 1, num))) break; long i, end;
rb_yield(i);
i = rb_funcall(i, '+', 1, INT2FIX(1)); end = FIX2LONG(num);
for (i=0; i<end; i++) {
rb_yield(LONG2FIX(i));
}
} }
} else {
return num; VALUE i = INT2FIX(0);
for (;;) {
if (!RTEST(rb_funcall(i, '<', 1, num))) break;
rb_yield(i);
i = rb_funcall(i, '+', 1, INT2FIX(1));
}
}
return num;
} }
static VALUE static VALUE