fix Yap_compare_terms for 64 bit code.
This commit is contained in:
parent
f8e3c7d347
commit
e283f6406a
@ -317,8 +317,9 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
return 1;
|
||||
return -1;
|
||||
} else {
|
||||
if (IsIntTerm(t2))
|
||||
if (IsIntTerm(t2)) {
|
||||
return IntOfTerm(t1) - IntOfTerm(t2);
|
||||
}
|
||||
if (IsFloatTerm(t2)) {
|
||||
return 1;
|
||||
}
|
||||
@ -441,9 +442,9 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
||||
}
|
||||
}
|
||||
|
||||
int Yap_compare_terms(CELL d0, CELL d1)
|
||||
Int Yap_compare_terms(Term d0, Term d1)
|
||||
{
|
||||
return (compare(Deref(d0),Deref(d1)));
|
||||
return compare(Deref(d0),Deref(d1));
|
||||
}
|
||||
|
||||
static Int
|
||||
|
4
C/sort.c
4
C/sort.c
@ -267,14 +267,14 @@ Int compact_mergesort(CELL *pt, Int size, int my_p)
|
||||
while (pt_left < end_pt_left && pt_right < end_pt_right) {
|
||||
/* if the element to the left is larger than the one to the right */
|
||||
Int cmp = Yap_compare_terms(pt_left[0], pt_right[0]);
|
||||
if (cmp < 0) {
|
||||
if (cmp < (Int)0) {
|
||||
/* copy the one to the left */
|
||||
pt[0] = pt_left[0];
|
||||
/* and avance the two pointers */
|
||||
pt += 2;
|
||||
size ++;
|
||||
pt_left += 2;
|
||||
} else if (cmp == 0) {
|
||||
} else if (cmp == (Int)0) {
|
||||
/* otherwise, just skip one of them, anyone */
|
||||
pt_left += 2;
|
||||
} else {
|
||||
|
@ -140,7 +140,7 @@ void STD_PROTO(Yap_AssertzClause,(struct pred_entry *, yamop *));
|
||||
|
||||
|
||||
/* cmppreds.c */
|
||||
int STD_PROTO(Yap_compare_terms,(Term,Term));
|
||||
Int STD_PROTO(Yap_compare_terms,(Term,Term));
|
||||
void STD_PROTO(Yap_InitCmpPreds,(void));
|
||||
|
||||
/* compiler.c */
|
||||
|
Reference in New Issue
Block a user