mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* complex.c: renamed some static functions.
* rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae96b225c4
commit
53125214cc
3 changed files with 28 additions and 23 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Jun 28 09:21:00 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* complex.c: renamed some static functions.
|
||||
|
||||
* rational.c: ditto.
|
||||
|
||||
Sat Jun 27 19:06:22 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* complex.c (nucomp_addsub): new
|
||||
|
|
26
complex.c
26
complex.c
|
@ -585,9 +585,9 @@ nucomp_negate(VALUE self)
|
|||
f_negate(dat->real), f_negate(dat->imag));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
nucomp_addsub(VALUE self, VALUE other,
|
||||
VALUE (*func)(VALUE, VALUE), ID id)
|
||||
inline static VALUE
|
||||
f_addsub(VALUE self, VALUE other,
|
||||
VALUE (*func)(VALUE, VALUE), ID id)
|
||||
{
|
||||
if (k_complex_p(other)) {
|
||||
VALUE real, imag;
|
||||
|
@ -617,7 +617,7 @@ nucomp_addsub(VALUE self, VALUE other,
|
|||
static VALUE
|
||||
nucomp_add(VALUE self, VALUE other)
|
||||
{
|
||||
return nucomp_addsub(self, other, f_add, '+');
|
||||
return f_addsub(self, other, f_add, '+');
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -629,7 +629,7 @@ nucomp_add(VALUE self, VALUE other)
|
|||
static VALUE
|
||||
nucomp_sub(VALUE self, VALUE other)
|
||||
{
|
||||
return nucomp_addsub(self, other, f_sub, '-');
|
||||
return f_addsub(self, other, f_sub, '-');
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -663,9 +663,9 @@ nucomp_mul(VALUE self, VALUE other)
|
|||
return rb_num_coerce_bin(self, other, '*');
|
||||
}
|
||||
|
||||
static VALUE
|
||||
nucomp_divide(VALUE self, VALUE other,
|
||||
VALUE (*func)(VALUE, VALUE), ID id)
|
||||
inline static VALUE
|
||||
f_divide(VALUE self, VALUE other,
|
||||
VALUE (*func)(VALUE, VALUE), ID id)
|
||||
{
|
||||
if (k_complex_p(other)) {
|
||||
int flo;
|
||||
|
@ -730,7 +730,7 @@ nucomp_divide(VALUE self, VALUE other,
|
|||
static VALUE
|
||||
nucomp_div(VALUE self, VALUE other)
|
||||
{
|
||||
return nucomp_divide(self, other, f_quo, id_quo);
|
||||
return f_divide(self, other, f_quo, id_quo);
|
||||
}
|
||||
|
||||
#define nucomp_quo nucomp_div
|
||||
|
@ -748,7 +748,7 @@ nucomp_div(VALUE self, VALUE other)
|
|||
static VALUE
|
||||
nucomp_fdiv(VALUE self, VALUE other)
|
||||
{
|
||||
return nucomp_divide(self, other, f_fdiv, id_fdiv);
|
||||
return f_divide(self, other, f_fdiv, id_fdiv);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1113,7 +1113,7 @@ f_tpositive_p(VALUE x)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
nucomp_format(VALUE self, VALUE (*func)(VALUE))
|
||||
f_format(VALUE self, VALUE (*func)(VALUE))
|
||||
{
|
||||
VALUE s, impos;
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ nucomp_format(VALUE self, VALUE (*func)(VALUE))
|
|||
static VALUE
|
||||
nucomp_to_s(VALUE self)
|
||||
{
|
||||
return nucomp_format(self, f_to_s);
|
||||
return f_format(self, f_to_s);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1156,7 +1156,7 @@ nucomp_inspect(VALUE self)
|
|||
VALUE s;
|
||||
|
||||
s = rb_usascii_str_new2("(");
|
||||
rb_str_concat(s, nucomp_format(self, f_inspect));
|
||||
rb_str_concat(s, f_format(self, f_inspect));
|
||||
rb_str_cat2(s, ")");
|
||||
|
||||
return s;
|
||||
|
|
19
rational.c
19
rational.c
|
@ -934,7 +934,7 @@ nurat_expt(VALUE self, VALUE other)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* rat <=> numeric -> -1, 0 or +1
|
||||
* rat <=> numeric -> -1, 0, +1 or nil
|
||||
*
|
||||
* Performs comparison and returns -1, 0, or +1.
|
||||
*
|
||||
|
@ -1156,8 +1156,7 @@ nurat_round(VALUE self)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
nurat_round_common(int argc, VALUE *argv, VALUE self,
|
||||
VALUE (*func)(VALUE))
|
||||
f_round_common(int argc, VALUE *argv, VALUE self, VALUE (*func)(VALUE))
|
||||
{
|
||||
VALUE n, b, s;
|
||||
|
||||
|
@ -1205,7 +1204,7 @@ nurat_round_common(int argc, VALUE *argv, VALUE self,
|
|||
static VALUE
|
||||
nurat_floor_n(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
return nurat_round_common(argc, argv, self, nurat_floor);
|
||||
return f_round_common(argc, argv, self, nurat_floor);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1231,7 +1230,7 @@ nurat_floor_n(int argc, VALUE *argv, VALUE self)
|
|||
static VALUE
|
||||
nurat_ceil_n(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
return nurat_round_common(argc, argv, self, nurat_ceil);
|
||||
return f_round_common(argc, argv, self, nurat_ceil);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1257,7 +1256,7 @@ nurat_ceil_n(int argc, VALUE *argv, VALUE self)
|
|||
static VALUE
|
||||
nurat_truncate_n(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
return nurat_round_common(argc, argv, self, nurat_truncate);
|
||||
return f_round_common(argc, argv, self, nurat_truncate);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1284,7 +1283,7 @@ nurat_truncate_n(int argc, VALUE *argv, VALUE self)
|
|||
static VALUE
|
||||
nurat_round_n(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
return nurat_round_common(argc, argv, self, nurat_round);
|
||||
return f_round_common(argc, argv, self, nurat_round);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1342,7 +1341,7 @@ nurat_hash(VALUE self)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
nurat_format(VALUE self, VALUE (*func)(VALUE))
|
||||
f_format(VALUE self, VALUE (*func)(VALUE))
|
||||
{
|
||||
VALUE s;
|
||||
get_dat1(self);
|
||||
|
@ -1369,7 +1368,7 @@ nurat_format(VALUE self, VALUE (*func)(VALUE))
|
|||
static VALUE
|
||||
nurat_to_s(VALUE self)
|
||||
{
|
||||
return nurat_format(self, f_to_s);
|
||||
return f_format(self, f_to_s);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1390,7 +1389,7 @@ nurat_inspect(VALUE self)
|
|||
VALUE s;
|
||||
|
||||
s = rb_usascii_str_new2("(");
|
||||
rb_str_concat(s, nurat_format(self, f_inspect));
|
||||
rb_str_concat(s, f_format(self, f_inspect));
|
||||
rb_str_cat2(s, ")");
|
||||
|
||||
return s;
|
||||
|
|
Loading…
Reference in a new issue