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

ruby-changes:44797

From: mrkn <ko1@a...>
Date: Tue, 22 Nov 2016 13:55:02 +0900 (JST)
Subject: [ruby-changes:44797] mrkn:r56870 (trunk): complex.c: optimize Kernel#Complex

mrkn	2016-11-22 13:54:57 +0900 (Tue, 22 Nov 2016)

  New Revision: 56870

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

  Log:
    complex.c: optimize Kernel#Complex
    
    * complex.c (nucomp_f_complex): use nucomp_s_convert directly.
    
    * complex.c (id_convert): removed.

  Modified files:
    trunk/complex.c
Index: complex.c
===================================================================
--- complex.c	(revision 56869)
+++ complex.c	(revision 56870)
@@ -30,7 +30,7 @@ VALUE rb_cComplex; https://github.com/ruby/ruby/blob/trunk/complex.c#L30
 static VALUE nucomp_abs(VALUE self);
 static VALUE nucomp_arg(VALUE self);
 
-static ID id_abs, id_arg, id_convert,
+static ID id_abs, id_arg,
     id_denominator, id_expt, id_fdiv,
     id_negate, id_numerator, id_quo,
     id_real_p, id_to_f, id_to_i, id_to_r,
@@ -406,6 +406,8 @@ f_complex_new2(VALUE klass, VALUE x, VAL https://github.com/ruby/ruby/blob/trunk/complex.c#L406
     return nucomp_s_canonicalize_internal(klass, x, y);
 }
 
+static VALUE nucomp_s_convert(int argc, VALUE *argv, VALUE klass);
+
 /*
  * call-seq:
  *    Complex(x[, y])  ->  numeric
@@ -442,7 +444,7 @@ f_complex_new2(VALUE klass, VALUE x, VAL https://github.com/ruby/ruby/blob/trunk/complex.c#L444
 static VALUE
 nucomp_f_complex(int argc, VALUE *argv, VALUE klass)
 {
-    return rb_funcallv(rb_cComplex, id_convert, argc, argv);
+    return nucomp_s_convert(argc, argv, rb_cComplex);
 }
 
 #define imp1(n) \
@@ -1426,8 +1428,6 @@ rb_complex_polar(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/complex.c#L1428
     return f_complex_polar(rb_cComplex, x, y);
 }
 
-static VALUE nucomp_s_convert(int argc, VALUE *argv, VALUE klass);
-
 VALUE
 rb_Complex(VALUE x, VALUE y)
 {
@@ -2182,7 +2182,6 @@ Init_Complex(void) https://github.com/ruby/ruby/blob/trunk/complex.c#L2182
 
     id_abs = rb_intern("abs");
     id_arg = rb_intern("arg");
-    id_convert = rb_intern("convert");
     id_denominator = rb_intern("denominator");
     id_expt = rb_intern("**");
     id_fdiv = rb_intern("fdiv");

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

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