diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-31 12:17:18 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-31 12:17:18 +0000 |
commit | 83a0709174f9f99038b45914ee54acd7c126f11b (patch) | |
tree | 43ff78bd13a795e4df422caa2bcd3b8232100e7b /ext/-test-/bignum/mul.c | |
parent | d0d63cff8ac29b294d6751c61528bb01c4d30d64 (diff) | |
download | ruby-83a0709174f9f99038b45914ee54acd7c126f11b.tar.gz |
* bignum.c: Use GMP to accelerate big Bignum multiplication.
(bary_mul_gmp): New function.
(bary_mul): Use bary_mul_gmp.
(bigsq): Use different threshold with GMP.
* configure.in: Detect GMP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-/bignum/mul.c')
-rw-r--r-- | ext/-test-/bignum/mul.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/-test-/bignum/mul.c b/ext/-test-/bignum/mul.c index ad416a9112..758465b567 100644 --- a/ext/-test-/bignum/mul.c +++ b/ext/-test-/bignum/mul.c @@ -42,6 +42,16 @@ mul_toom3(VALUE x, VALUE y) return rb_big_norm(rb_big_mul_toom3(big(x), big(y))); } +#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) +static VALUE +mul_gmp(VALUE x, VALUE y) +{ + return rb_big_norm(rb_big_mul_gmp(big(x), big(y))); +} +#else +#define mul_gmp rb_f_notimplement +#endif + void Init_mul(VALUE klass) { @@ -52,4 +62,5 @@ Init_mul(VALUE klass) rb_define_method(rb_cInteger, "big_mul_balance", mul_balance, 1); rb_define_method(rb_cInteger, "big_mul_karatsuba", mul_karatsuba, 1); rb_define_method(rb_cInteger, "big_mul_toom3", mul_toom3, 1); + rb_define_method(rb_cInteger, "big_mul_gmp", mul_gmp, 1); } |