summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-30 15:00:12 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-30 15:00:12 +0000
commitef260b085eea729efaa46e93ac71d08a3fa210c6 (patch)
tree3771797df1d09540f20d74f55086885490e6a439 /complex.c
parent3730710d79aa0bde6ab5b36e18c734dd9718aac0 (diff)
revert git backfire in r15860; sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/complex.c b/complex.c
index 58704110ce..1644746360 100644
--- a/complex.c
+++ b/complex.c
@@ -85,6 +85,22 @@ f_add(VALUE x, VALUE y)
}
inline static VALUE
+f_cmp(VALUE x, VALUE y)
+{
+ VALUE r;
+ if (FIXNUM_P(x) && FIXNUM_P(y)) {
+ long c = FIX2LONG(x) - FIX2LONG(y);
+ if (c > 0)
+ c = 1;
+ else if (c < 0)
+ c = -1;
+ r = INT2FIX(c);
+ } else
+ r = rb_funcall(x, id_cmp, 1, y);
+ return r;
+}
+
+inline static VALUE
f_div(VALUE x, VALUE y)
{
VALUE r;
@@ -184,22 +200,6 @@ fun1(to_r)
fun1(to_s)
fun1(truncate)
-inline static VALUE
-f_cmp(VALUE x, VALUE y)
-{
- VALUE r;
- if (FIXNUM_P(x) && FIXNUM_P(y)) {
- long c = FIX2LONG(x) - FIX2LONG(y);
- if (c > 0)
- c = 1;
- else if (c < 0)
- c = -1;
- r = INT2FIX(c);
- } else
- r = rb_funcall(x, id_cmp, 1, y);
- return r;
-}
-
fun2(coerce)
fun2(divmod)
@@ -1016,22 +1016,13 @@ nucomp_inexact_p(VALUE self)
return f_boolcast(!nucomp_exact_p(self));
}
-extern VALUE rb_gcd(VALUE x, VALUE y);
-
-static VALUE
-f_lcm(VALUE x, VALUE y)
-{
- if (f_zero_p(x) || f_zero_p(y))
- return ZERO;
- else
- return f_abs(f_mul(f_div(x, rb_gcd(x, y)), y));
-}
+extern VALUE rb_lcm(VALUE x, VALUE y);
static VALUE
nucomp_denominator(VALUE self)
{
get_dat1(self);
- return f_lcm(f_denominator(dat->real), f_denominator(dat->image));
+ return rb_lcm(f_denominator(dat->real), f_denominator(dat->image));
}
static VALUE