diff --git a/mrbgems/mruby-bigint/README.md b/mrbgems/mruby-bigint/README.md index bf15b7f24..81b368601 100644 --- a/mrbgems/mruby-bigint/README.md +++ b/mrbgems/mruby-bigint/README.md @@ -3,7 +3,3 @@ This extension uses fgmp, which is a public domain implementation of a subset of the GNU gmp library by Mark Henderson But it's heavily modified to fit with mruby. You can get the original source code from You can read the original README for fgmp in - -## Implementation - -This mrbgem is only to turn on `MRB_USE_BIGINT` flag. The implementation resides in `include/mruby/bigint.h` and `src/bigint.c`. diff --git a/src/bigint.c b/mrbgems/mruby-bigint/core/bigint.c similarity index 99% rename from src/bigint.c rename to mrbgems/mruby-bigint/core/bigint.c index 66683f5e1..93ca97549 100644 --- a/src/bigint.c +++ b/mrbgems/mruby-bigint/core/bigint.c @@ -3,16 +3,15 @@ ** ** See Copyright Notice in mruby.h */ -#ifdef MRB_USE_BIGINT #include #include #include -#include #include #include #include #include +#include "bigint.h" static void mpz_init(mrb_state *mrb, mpz_t *s) @@ -1458,4 +1457,3 @@ mrb_bint_rshift(mrb_state *mrb, mrb_value x, mrb_int width) } return bint_norm(mrb, b2); } -#endif /* MRB_USE_BIGINT */ diff --git a/include/mruby/bigint.h b/mrbgems/mruby-bigint/core/bigint.h similarity index 97% rename from include/mruby/bigint.h rename to mrbgems/mruby-bigint/core/bigint.h index 925a5d27a..24ed6ee7c 100644 --- a/include/mruby/bigint.h +++ b/mrbgems/mruby-bigint/core/bigint.h @@ -3,7 +3,6 @@ ** ** See Copyright Notice in mruby.h */ -#ifdef MRB_USE_BIGINT #ifndef MRUBY_BIGINT_H #define MRUBY_BIGINT_H @@ -85,6 +84,4 @@ struct RBigint { #define RBIGINT(v) ((struct RBigint*)mrb_ptr(v)) -#endif - -#endif /* MRB_USE_BIGINT */ +#endif /* MRUBY_BIGINT_H */ diff --git a/mrbgems/mruby-bigint/mrbgem.rake b/mrbgems/mruby-bigint/mrbgem.rake index 528a7ee70..a1039bf57 100644 --- a/mrbgems/mruby-bigint/mrbgem.rake +++ b/mrbgems/mruby-bigint/mrbgem.rake @@ -3,4 +3,8 @@ MRuby::Gem::Specification.new('mruby-bigint') do |spec| spec.author = 'mruby developers' spec.summary = 'Integer class extension to multiple-precision' spec.build.defines << "MRB_USE_BIGINT" + + spec.build.libmruby_core_objs << Dir.glob(File.join(__dir__, "core/**/*.c")).map { |fn| + objfile(fn.relative_path_from(__dir__).pathmap("#{spec.build_dir}/%X")) + } end diff --git a/mrbgems/mruby-numeric-ext/src/numeric_ext.c b/mrbgems/mruby-numeric-ext/src/numeric_ext.c index 1010d8fa7..7ea0e9772 100644 --- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c +++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c @@ -4,8 +4,6 @@ #include #ifdef MRB_USE_BIGINT -#include - static mrb_value bint_allbits(mrb_state *mrb, mrb_value x, mrb_value y) {