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.
This commit is contained in:
dearblue
2022-04-23 21:19:12 +09:00
parent e3e85df13a
commit cc3a213fef
5 changed files with 6 additions and 13 deletions
-4
View File
@@ -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 <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`.
@@ -3,16 +3,15 @@
**
** 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 */
@@ -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 */
+4
View File
@@ -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
@@ -4,8 +4,6 @@
#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)
{