summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-29 16:11:12 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-29 16:11:12 +0000
commitbb51917dcee8660eebc6c157355d261f59e695e3 (patch)
tree08b2b31562a223a6e5d72a5d2ce2db0bb6c2a818 /complex.c
parent85ebe116040992b1775a7b13682b723775231de1 (diff)
merged 20011 from trunk into ruby_1_9_1.
* complex.c: uses macro in declarations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/complex.c b/complex.c
index d59305eb11..b4ac3e95e5 100644
--- a/complex.c
+++ b/complex.c
@@ -426,21 +426,31 @@ nucomp_f_complex(int argc, VALUE *argv, VALUE klass)
return rb_funcall2(rb_cComplex, id_convert, argc, argv);
}
-extern VALUE rb_math_atan2(VALUE x, VALUE y);
-extern VALUE rb_math_cos(VALUE x);
-extern VALUE rb_math_cosh(VALUE x);
-extern VALUE rb_math_exp(VALUE x);
-extern VALUE rb_math_hypot(VALUE x, VALUE y);
-extern VALUE rb_math_log(int argc, VALUE *argv);
-extern VALUE rb_math_sin(VALUE x);
-extern VALUE rb_math_sinh(VALUE x);
-extern VALUE rb_math_sqrt(VALUE x);
+#define imp1(n) \
+extern VALUE rb_math_##n(VALUE x);\
+inline static VALUE \
+m_##n##_bang(x)\
+{\
+ return rb_math_##n(x);\
+}
-#define m_atan2_bang(x,y) rb_math_atan2(x,y)
-#define m_cos_bang(x) rb_math_cos(x)
-#define m_cosh_bang(x) rb_math_cosh(x)
-#define m_exp_bang(x) rb_math_exp(x)
-#define m_hypot(x,y) rb_math_hypot(x,y)
+#define imp2(n) \
+extern VALUE rb_math_##n(VALUE x, VALUE y);\
+inline static VALUE \
+m_##n##_bang(x, y)\
+{\
+ return rb_math_##n(x, y);\
+}
+
+imp2(atan2)
+imp1(cos)
+imp1(cosh)
+imp1(exp)
+imp2(hypot)
+
+#define m_hypot(x,y) m_hypot_bang(x,y)
+
+extern VALUE rb_math_log(int argc, VALUE *argv);
static VALUE
m_log_bang(VALUE x)
@@ -448,9 +458,9 @@ m_log_bang(VALUE x)
return rb_math_log(1, &x);
}
-#define m_sin_bang(x) rb_math_sin(x)
-#define m_sinh_bang(x) rb_math_sinh(x)
-#define m_sqrt_bang(x) rb_math_sqrt(x)
+imp1(sin)
+imp1(sinh)
+imp1(sqrt)
static VALUE
m_cos(VALUE x)