summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-23 04:24:16 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-23 04:24:16 +0000
commit2f7ff72148618e75737ce930d42b4b8131008e8c (patch)
tree7b07158b088c2177db2bd6f6ee7656f11f871054
parenta53ba41f37541b3cb40c61a53e213974e2344e04 (diff)
* numeric.c (fix_cmp, fix_equal): Remove FIX2LONG() to optimize.
suggested in http://t-a-w.blogspot.com/2007/02/making-ruby-faster.html. [ruby-talk:240223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@11823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--numeric.c11
2 files changed, 11 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index cb04a522c1..1c35dada91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Feb 23 13:04:43 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * numeric.c (fix_cmp, fix_equal): Remove FIX2LONG() to optimize.
+ suggested in
+ http://t-a-w.blogspot.com/2007/02/making-ruby-faster.html.
+ [ruby-talk:240223]
+
Fri Feb 23 12:47:13 2007 James Edward Gray II <james@grayproductions.net>
* lib/xmlrpc/client.rb (XMLRPC::Client::do_rpc): Make the
diff --git a/numeric.c b/numeric.c
index 97e22c058c..23d35a1cd5 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2226,12 +2226,9 @@ static VALUE
fix_equal(x, y)
VALUE x, y;
{
- if (FIXNUM_P(y)) {
- return (FIX2LONG(x) == FIX2LONG(y))?Qtrue:Qfalse;
- }
- else {
- return num_equal(x, y);
- }
+ if (x == y) return Qtrue;
+ if (FIXNUM_P(y)) return Qfalse;
+ return num_equal(x, y);
}
/*
@@ -2247,10 +2244,10 @@ static VALUE
fix_cmp(x, y)
VALUE x, y;
{
+ if (x == y) return INT2FIX(0);
if (FIXNUM_P(y)) {
long a = FIX2LONG(x), b = FIX2LONG(y);
- if (a == b) return INT2FIX(0);
if (a > b) return INT2FIX(1);
return INT2FIX(-1);
}