[前][次][番号順一覧][スレッド一覧]

ruby-changes:44754

From: mrkn <ko1@a...>
Date: Fri, 18 Nov 2016 23:24:20 +0900 (JST)
Subject: [ruby-changes:44754] mrkn:r56827 (trunk): complex.c: refactoring

mrkn	2016-11-18 23:24:15 +0900 (Fri, 18 Nov 2016)

  New Revision: 56827

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56827

  Log:
    complex.c: refactoring
    
    * complex.c (nucomp_abs): use rb_math_hypot directly.
    
    * complex.c (nucomp_arg): use rb_math_atan2 directly.
    
    * complex.c (imp2, m_{atan2,hypot}_bang, m_hypot): removed.

  Modified files:
    trunk/complex.c
Index: complex.c
===================================================================
--- complex.c	(revision 56826)
+++ complex.c	(revision 56827)
@@ -432,20 +432,9 @@ m_##n##_bang(VALUE x)\ https://github.com/ruby/ruby/blob/trunk/complex.c#L432
     return rb_math_##n(x);\
 }
 
-#define imp2(n) \
-inline static VALUE \
-m_##n##_bang(VALUE x, VALUE 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))
 
 static VALUE
 m_log_bang(VALUE x)
@@ -1015,7 +1004,7 @@ nucomp_abs(VALUE self) https://github.com/ruby/ruby/blob/trunk/complex.c#L1004
 	    a = f_to_f(a);
 	return a;
     }
-    return m_hypot(dat->real, dat->imag);
+    return rb_math_hypot(dat->real, dat->imag);
 }
 
 /*
@@ -1049,7 +1038,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/complex.c#L1038
 nucomp_arg(VALUE self)
 {
     get_dat1(self);
-    return m_atan2_bang(dat->imag, dat->real);
+    return rb_math_atan2(dat->imag, dat->real);
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]