From 6e17ac0070b01729aea5f5bc12d6c6e4b1ff182d Mon Sep 17 00:00:00 2001 From: vsc Date: Thu, 1 May 2003 21:07:11 +0000 Subject: [PATCH] fix count clauses fix bigint in index.c git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@824 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/cdmgr.c | 15 ++++----------- C/index.c | 8 ++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index c5f7e9e02..954ce3513 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -1445,7 +1445,6 @@ p_number_of_clauses(void) Term t2 = Deref(ARG2); int ncl = 0; Prop pe; - yamop *q; int mod; if (IsVarTerm(t2) || !IsAtomTerm(t2)) { @@ -1458,19 +1457,13 @@ p_number_of_clauses(void) } else if (IsApplTerm(t)) { register Functor f = FunctorOfTerm(t); pe = PredPropByFunc(f, mod); - } else + } else { return (FALSE); - q = RepPredProp(pe)->cs.p_code.FirstClause; - READ_LOCK(RepPredProp(pe)->PRWLock); - if (q != NIL) { - while (q != RepPredProp(pe)->cs.p_code.LastClause) { - ncl++; - q = NextClause(q); - } } + READ_LOCK(RepPredProp(pe)->PRWLock); + ncl = RepPredProp(pe)->cs.p_code.NOfClauses; READ_UNLOCK(RepPredProp(pe)->PRWLock); - t = MkIntegerTerm(ncl); - return (Yap_unify_constant(ARG3, t)); + return (Yap_unify_constant(ARG3, MkIntegerTerm(ncl))); } static Int diff --git a/C/index.c b/C/index.c index 34c1d6db4..1ffe60d7c 100644 --- a/C/index.c +++ b/C/index.c @@ -1124,7 +1124,11 @@ add_info(ClauseDef *clause, UInt regno) case _get_bigint: if (regcopy_in(myregs, nofregs, cl->u.xc.x)) { clause->WorkPC = cl; +#ifdef USE_GMP clause->Tag = AbsAppl((CELL *)FunctorBigInt); +#else + clause->Tag = AbsAppl((CELL *)FunctorLongInt); +#endif return; } else { cl = NEXTOP(cl,xc); @@ -1673,7 +1677,11 @@ add_arg_info(ClauseDef *clause, UInt argno) case _unify_bigint: case _unify_l_bigint: if (argno == 1) { +#ifdef USE_GMP clause->Tag = AbsAppl((CELL *)FunctorBigInt); +#else + clause->Tag = AbsAppl((CELL *)FunctorLongInt); +#endif return; } argno--;