summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-13 07:22:35 (GMT)
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-13 07:22:35 (GMT)
commit1b5acc876baaf80d17d1e142a488b63084035c68 (patch)
tree94732fa0524c8e8de8215728ecf3276b8ee820c5 /numeric.c
parent4e85feed334f1904ae35a222eae4d09560cef8eb (diff)
array.c: Improve performance of Array#sort with float elements
* array.c (sort_2): improve performance of Array#sort with float elements. * internal.h (cmp_opt_Float, cmp_opt_data): added for checking whether or not Float#<=> can be optimizable. * numeric.c (rb_float_cmp): added for internal use. * internal.h (rb_float_cmp): ditto. [Bug #13340] [ruby-dev:50023] [Fix GH-1539] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index f8f0766..f66fdae 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1520,6 +1520,12 @@ flo_cmp(VALUE x, VALUE y)
return rb_dbl_cmp(a, b);
}
+int
+rb_float_cmp(VALUE x, VALUE y)
+{
+ return NUM2INT(flo_cmp(x, y));
+}
+
/*
* call-seq:
* float > real -> true or false