diff --git a/C/cmppreds.c b/C/cmppreds.c index 9402f82c7..d750fe84c 100644 --- a/C/cmppreds.c +++ b/C/cmppreds.c @@ -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 diff --git a/C/sort.c b/C/sort.c index 0f78c6fa5..6b2d06617 100644 --- a/C/sort.c +++ b/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 { diff --git a/H/Yapproto.h b/H/Yapproto.h index 54e63a568..d61c5813a 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -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 */