Move bigint implementation files to `mruby-bigint`
Users can now switch to their own implementation of GEM.
However, we do not guarantee that this will not be a problem in the current situation.
This may need to be improved in the future.
MODIFY
mrbgems/mruby-bigint/README.md
mrbgems/mruby-bigint/README.md
This extension uses fgmp, which is a public domain implementation of a subset of the GNU gmp library by Mark Henderson <markh@wimsey.bc.ca>
But it's heavily modified to fit with mruby. You can get the original source code from <https://github.com/deischi/fgmp.git>
You can read the original README for fgmp in <README-fgmp.md>
-
-## Implementation
-
-This mrbgem is only to turn on `MRB_USE_BIGINT` flag. The implementation resides in `include/mruby/bigint.h` and `src/bigint.c`.

RENAME
src/bigint.c
mrbgems/mruby-bigint/core/bigint.c
**
** See Copyright Notice in mruby.h
*/
-#ifdef MRB_USE_BIGINT
#include <mruby.h>
#include <mruby/object.h>
#include <mruby/numeric.h>
-#include <mruby/bigint.h>
#include <mruby/array.h>
#include <mruby/string.h>
#include <mruby/internal.h>
#include <string.h>
+#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 */

RENAME
include/mruby/bigint.h
mrbgems/mruby-bigint/core/bigint.h
**
** 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 */

MODIFY
mrbgems/mruby-bigint/mrbgem.rake
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

MODIFY
mrbgems/mruby-numeric-ext/src/numeric_ext.c
mrbgems/mruby-numeric-ext/src/numeric_ext.c
#include <mruby/presym.h>
#ifdef MRB_USE_BIGINT
-#include <mruby/bigint.h>
-
static mrb_value
bint_allbits(mrb_state *mrb, mrb_value x, mrb_value y)
{

Move bigint implementation files to `mruby-bigint`

Users can now switch to their own implementation of GEM.
However, we do not guarantee that this will not be a problem in the current situation.
This may need to be improved in the future.