ruby-changes:10988
From: matz <ko1@a...>
Date: Tue, 24 Feb 2009 00:51:42 +0900 (JST)
Subject: [ruby-changes:10988] Ruby:r22575 (trunk): * math.c (Need_Float): call rb_to_float() only when it is really
matz 2009-02-24 00:51:31 +0900 (Tue, 24 Feb 2009) New Revision: 22575 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22575 Log: * math.c (Need_Float): call rb_to_float() only when it is really needed. small performance improvement. Modified files: trunk/ChangeLog trunk/math.c Index: math.c =================================================================== --- math.c (revision 22574) +++ math.c (revision 22575) @@ -16,7 +16,7 @@ VALUE rb_mMath; extern VALUE rb_to_float(VALUE val); -#define Need_Float(x) (x) = rb_to_float(x) +#define Need_Float(x) do {if (TYPE(x) != T_FLOAT) {(x) = rb_to_float(x);}} while(0) #define Need_Float2(x,y) do {\ Need_Float(x);\ Need_Float(y);\ Index: ChangeLog =================================================================== --- ChangeLog (revision 22574) +++ ChangeLog (revision 22575) @@ -3,6 +3,9 @@ * range.c (range_each): check #succ only when it is really needed. small performance improvement. + * math.c (Need_Float): call rb_to_float() only when it is really + needed. small performance improvement. + Tue Feb 24 00:19:33 2009 Yukihiro Matsumoto <matz@r...> * lib/pathname.rb (Pathname#foreachline): removed wrongly -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/