From ee648c5870959bb11ba6e42375c7bee30c1c07e8 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 27 Jun 2012 12:45:04 +0200 Subject: [PATCH] make heur4 a bit more deterministic --- ir/be/becopyheur4.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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); } /** -- 2.20.1