handle PL_unify_int64 without bigint when number is small enough.
This commit is contained in:
parent
3966822bff
commit
51bcb1f5a3
@ -931,7 +931,10 @@ X_API int PL_put_integer(term_t t, long n)
|
|||||||
X_API int PL_put_int64(term_t t, int64_t n)
|
X_API int PL_put_int64(term_t t, int64_t n)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
#if USE_GMP
|
#if SIZEOF_INT_P==8
|
||||||
|
Yap_PutInSlot(t,MkIntegerTerm(n));
|
||||||
|
return TRUE;
|
||||||
|
#elif USE_GMP
|
||||||
char s[64];
|
char s[64];
|
||||||
MP_INT rop;
|
MP_INT rop;
|
||||||
|
|
||||||
@ -1176,6 +1179,8 @@ X_API int PL_unify_int64(term_t t, int64_t n)
|
|||||||
iterm = YAP_MkBigNumTerm((void *)&rop);
|
iterm = YAP_MkBigNumTerm((void *)&rop);
|
||||||
return YAP_Unify(Yap_GetFromSlot(t PASS_REGS),iterm);
|
return YAP_Unify(Yap_GetFromSlot(t PASS_REGS),iterm);
|
||||||
#else
|
#else
|
||||||
|
if ((long)n == n)
|
||||||
|
return PL_unify_integer(t, n);
|
||||||
fprintf(stderr,"Error in PL_unify_int64: please install GMP\n");
|
fprintf(stderr,"Error in PL_unify_int64: please install GMP\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user