able to commit 64 bits

This commit is contained in:
Costa Vitor 2009-06-05 12:18:10 -05:00
parent 7e108201b0
commit 5e4be93491
4 changed files with 31 additions and 4 deletions

View File

@ -362,6 +362,17 @@ Yap_gmp_exp_big_int(MP_INT *b, Int i)
return MkBigAndClose(&new);
}
Term
Yap_gmp_big_from_64bits(YAP_LONG_LONG i)
{
char s[64];
MP_INT new;
sprintf(s, "%lld", (long long int)i);
mpz_init_set_str (&new, s, 10);
return MkBigAndClose(&new);
}
#endif

View File

@ -3904,7 +3904,7 @@ p_inform_gc(void)
{
Term tn = MkIntegerTerm(TotGcTime);
Term tt = MkIntegerTerm(GcCalls);
Term ts = MkIntegerTerm((TotGcRecovered*sizeof(CELL)));
Term ts = Yap_Mk64IntegerTerm((TotGcRecovered*sizeof(CELL)));
return(Yap_unify(tn, ARG2) && Yap_unify(tt, ARG1) && Yap_unify(ts, ARG3));

View File

@ -431,8 +431,6 @@ IsPrimitiveTerm (Term t)
|| (IsApplTerm (t) && IsBlobFunctor (FunctorOfTerm (t)))));
}
#ifdef TERM_EXTENSIONS

View File

@ -225,10 +225,28 @@ Term STD_PROTO(Yap_gmp_mod_int_big,(Int, MP_INT *));
Term STD_PROTO(Yap_gmp_exp_ints,(Int,Int));
Term STD_PROTO(Yap_gmp_exp_big_int,(MP_INT *,Int));
Term STD_PROTO(Yap_gmp_big_from_64bits,(YAP_LONG_LONG));
Term STD_PROTO(Yap_gmp_add_float_big,(Float, MP_INT *));
Term STD_PROTO(Yap_gmp_sub_float_big,(Float, MP_INT *));
Term STD_PROTO(Yap_gmp_sub_big_float,(MP_INT *, Float));
Term STD_PROTO(Yap_gmp_mul_float_big,(Float, MP_INT *));
#endif
inline EXTERN Term Yap_Mk64IntegerTerm(YAP_LONG_LONG);
inline EXTERN Term
Yap_Mk64IntegerTerm(YAP_LONG_LONG i)
{
if (i <= Int_MAX || i >= Int_MIN) {
return MkIntegerTerm((Int)i);
} else {
#if USE_GMP
return Yap_gmp_big_from_64bits(i);
#else
return MkIntTerm(-1);
#endif
}
}