From 83a0709174f9f99038b45914ee54acd7c126f11b Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 31 Aug 2013 12:17:18 +0000 Subject: * 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 --- ext/-test-/bignum/mul.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ext/-test-/bignum') 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); } -- cgit v1.2.3