Added scheme_init_bignum

svn: r17399
This commit is contained in:
Kevin Tew 2009-12-25 18:05:01 +00:00
parent a7d4b7467d
commit 851fb462b2
3 changed files with 7 additions and 10 deletions

View File

@ -97,6 +97,11 @@ void scheme_bignum_use_fuel(long n);
static Scheme_Object *bignum_one;
void scheme_init_bignum() {
REGISTER_SO(bignum_one);
bignum_one = scheme_make_bignum(1);
}
#ifdef MZ_PRECISE_GC
# define SAFE_SPACE(var) bigdig var[1];
# define SCHEME_BIGDIG_SAFE(b, s) ((SCHEME_BIGDIG(b) == ((Small_Bignum *) mzALIAS b)->v) ? (s[0] = SCHEME_BIGDIG(b)[0], s) : SCHEME_BIGDIG(b))
@ -744,21 +749,11 @@ Scheme_Object *scheme_bignum_subtract(const Scheme_Object *a, const Scheme_Objec
Scheme_Object *scheme_bignum_add1(const Scheme_Object *n)
{
if (!bignum_one) {
REGISTER_SO(bignum_one);
bignum_one = scheme_make_bignum(1);
}
return bignum_add_sub(n, bignum_one, 0);
}
Scheme_Object *scheme_bignum_sub1(const Scheme_Object *n)
{
if (!bignum_one) {
REGISTER_SO(bignum_one);
bignum_one = scheme_make_bignum(1);
}
return bignum_add_sub(n, bignum_one, 1);
}

View File

@ -599,6 +599,7 @@ static void make_kernel_env(void)
MZTIMEIT(numarith, scheme_init_numarith(env));
MZTIMEIT(numcomp, scheme_init_numcomp(env));
MZTIMEIT(numstr, scheme_init_numstr(env));
MZTIMEIT(bignum, scheme_init_bignum());
MZTIMEIT(stx, scheme_init_stx(env));
MZTIMEIT(module, scheme_init_module(env));
MZTIMEIT(port, scheme_init_port(env));

View File

@ -170,6 +170,7 @@ void scheme_init_true_false(void);
void scheme_init_symbol_table(void);
void scheme_init_symbol_type(Scheme_Env *env);
void scheme_init_type();
void scheme_init_bignum();
void scheme_init_list(Scheme_Env *env);
void scheme_init_unsafe_list(Scheme_Env *env);
void scheme_init_stx(Scheme_Env *env);