* complex.c: uses macro in declarations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2008-10-28 15:45:29 +00:00
parent 746a09406e
commit f68296698a
2 changed files with 31 additions and 17 deletions

View File

@ -1,3 +1,7 @@
Wed Oct 29 00:43:39 2008 Tadayoshi Funaba <tadf@dotrb.org>
* complex.c: uses macro in declarations.
Wed Oct 29 00:26:00 2008 NAKAMURA Usaku <usa@ruby-lang.org> Wed Oct 29 00:26:00 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (rb_w32_open): need to seek to the end of the file when * win32/win32.c (rb_w32_open): need to seek to the end of the file when

View File

@ -426,21 +426,31 @@ nucomp_f_complex(int argc, VALUE *argv, VALUE klass)
return rb_funcall2(rb_cComplex, id_convert, argc, argv); return rb_funcall2(rb_cComplex, id_convert, argc, argv);
} }
extern VALUE rb_math_atan2(VALUE x, VALUE y); #define imp1(n) \
extern VALUE rb_math_cos(VALUE x); extern VALUE rb_math_##n(VALUE x);\
extern VALUE rb_math_cosh(VALUE x); inline static VALUE \
extern VALUE rb_math_exp(VALUE x); m_##n##_bang(x)\
extern VALUE rb_math_hypot(VALUE x, VALUE y); {\
extern VALUE rb_math_log(int argc, VALUE *argv); return rb_math_##n(x);\
extern VALUE rb_math_sin(VALUE x); }
extern VALUE rb_math_sinh(VALUE x);
extern VALUE rb_math_sqrt(VALUE x);
#define m_atan2_bang(x,y) rb_math_atan2(x,y) #define imp2(n) \
#define m_cos_bang(x) rb_math_cos(x) extern VALUE rb_math_##n(VALUE x, VALUE y);\
#define m_cosh_bang(x) rb_math_cosh(x) inline static VALUE \
#define m_exp_bang(x) rb_math_exp(x) m_##n##_bang(x, y)\
#define m_hypot(x,y) rb_math_hypot(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 static VALUE
m_log_bang(VALUE x) m_log_bang(VALUE x)
@ -448,9 +458,9 @@ m_log_bang(VALUE x)
return rb_math_log(1, &x); return rb_math_log(1, &x);
} }
#define m_sin_bang(x) rb_math_sin(x) imp1(sin)
#define m_sinh_bang(x) rb_math_sinh(x) imp1(sinh)
#define m_sqrt_bang(x) rb_math_sqrt(x) imp1(sqrt)
static VALUE static VALUE
m_cos(VALUE x) m_cos(VALUE x)