Fixed combo by fixing an old artefact from the older libFirm Cmp nodes.
[libfirm] / ir / stat / distrib.c
index cc6df37..02e60d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -54,7 +54,9 @@ static int int_cmp_fun(const void *elt, const void *key)
        const distrib_entry_t *p1 = (const distrib_entry_t*)elt;
        const distrib_entry_t *p2 = (const distrib_entry_t*)key;
 
-       return (char *)p1->object - (char *)p2->object;
+       if (p1->object == p2->object)
+               return 0;
+       return p1->object < p2->object ? -1 : 1;
 }
 
 /*
@@ -199,7 +201,7 @@ int stat_get_count_distrib_tbl(distrib_tbl_t *tbl)
 double stat_calc_mean_distrib_tbl(distrib_tbl_t *tbl)
 {
        distrib_entry_t *entry;
-       unsigned count;
+       size_t count;
        double sum;
 
        if (tbl->int_dist) {
@@ -246,7 +248,7 @@ double stat_calc_mean_distrib_tbl(distrib_tbl_t *tbl)
 double stat_calc_avg_distrib_tbl(distrib_tbl_t *tbl)
 {
        distrib_entry_t *entry;
-       unsigned        count = 0;
+       size_t          count = 0;
        double          sum   = 0.0;
 
        if (tbl->int_dist) {