diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-11 15:55:30 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-11 15:55:30 +0000 |
commit | 944e6a2804e7d3961964c586694d16ce036da55d (patch) | |
tree | 307f02a0d50d4ffdb9e82df1c345d072527b2b14 /internal.h | |
parent | 8492e990ab03eb8eb4415ac5ab05fb024349d7a3 (diff) | |
download | ruby-944e6a2804e7d3961964c586694d16ce036da55d.tar.gz |
rational.c: avoid needless object allocation with nurat_to_double
* rational.c (nurat_to_double): introduce to convert rational to double
without object allocation.
* rational.c (rb_rational_plus, nurat_{sub,mul,to_f}): rewrite by using
nurat_to_double.
* bignum.c (rb_big_fdiv_double): introduce to calculate fdiv and return
the result as a double value.
* bignum.c (big_fdiv{,_int,_float}): change the return types for
implementing rb_big_fdiv_double.
* bignum.c (rb_big_fdiv): rewrite by using rb_big_fdiv_double.
* numeric.c (rb_int_fdiv_double): introduce to calculate fdiv and return
the result as a double value.
* numeric.c (fix_fdiv_double): rewrite from fix_fdiv to return the
result as a double value.
* numeric.c (rb_int_fdiv): rewrite by using rb_int_fdiv_double.
* internal.h (rb_{big,int}_fdiv_double): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/internal.h b/internal.h index fec2dbeedf..be3694ecc6 100644 --- a/internal.h +++ b/internal.h @@ -891,7 +891,7 @@ size_t rb_ary_memsize(VALUE); /* bignum.c */ extern const char ruby_digitmap[]; -VALUE rb_big_fdiv(VALUE x, VALUE y); +double rb_big_fdiv_double(VALUE x, VALUE y); VALUE rb_big_uminus(VALUE x); VALUE rb_big_hash(VALUE); VALUE rb_big_odd_p(VALUE); @@ -1170,7 +1170,7 @@ VALUE rb_dbl_hash(double d); VALUE rb_fix_plus(VALUE x, VALUE y); VALUE rb_int_ge(VALUE x, VALUE y); enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts); -VALUE rb_int_fdiv(VALUE x, VALUE y); +double rb_int_fdiv_double(VALUE x, VALUE y); #if USE_FLONUM #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n))) |