From: Matthias Braun Date: Wed, 27 Jun 2012 10:45:04 +0000 (+0200) Subject: make heur4 a bit more deterministic X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=ee648c5870959bb11ba6e42375c7bee30c1c07e8;p=libfirm make heur4 a bit more deterministic --- diff --git a/ir/be/becopyheur4.c b/ir/be/becopyheur4.c index ad5ca80d0..6e228ff09 100644 --- a/ir/be/becopyheur4.c +++ b/ir/be/becopyheur4.c @@ -312,7 +312,13 @@ static __attribute__((unused)) int cmp_col_cost_lt(const void *a, const void *b) const col_cost_t *c1 = (const col_cost_t*)a; const col_cost_t *c2 = (const col_cost_t*)b; real_t diff = c1->cost - c2->cost; - return (diff > 0) - (diff < 0); + + if (diff < 0) + return 1; + if (diff > 0) + return -1; + + return QSORT_CMP(c1->col, c2->col); } static int cmp_col_cost_gt(const void *a, const void *b) @@ -321,10 +327,12 @@ static int cmp_col_cost_gt(const void *a, const void *b) const col_cost_t *c2 = (const col_cost_t*)b; real_t diff = c2->cost - c1->cost; - if (diff == 0.0) - return QSORT_CMP(c1->col, c2->col); + if (diff > 0) + return 1; + if (diff < 0) + return -1; - return (diff > 0) - (diff < 0); + return QSORT_CMP(c1->col, c2->col); } /**