From 497fa6222e47837f2b8d19931589f03846c331fc Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 23 Feb 2009 15:51:31 +0000 Subject: * math.c (Need_Float): call rb_to_float() only when it is really needed. small performance improvement. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- math.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'math.c') diff --git a/math.c b/math.c index 2043bebfe..cc557c960 100644 --- a/math.c +++ b/math.c @@ -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);\ -- cgit