Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
these terrible sort operators were working everywhere except on bsd, where qsort...
[simgrid.git] / src / surf / network.c
index f5dd903..21a86ea 100644 (file)
@@ -81,7 +81,8 @@ static double constant_bandwidth_constraint(double rate, double bound,
 
 static int factor_cmp(const void *pa, const void *pb)
 {
-  return (((s_smpi_factor_t*)pa)->factor > ((s_smpi_factor_t*)pb)->factor);
+  return (((s_smpi_factor_t*)pa)->factor > ((s_smpi_factor_t*)pb)->factor) ? 1 : 
+         (((s_smpi_factor_t*)pa)->factor < ((s_smpi_factor_t*)pb)->factor) ? -1 : 0;
 }
 
 
@@ -126,12 +127,12 @@ static double smpi_bandwidth_factor(double size)
   double current=1.0;
   xbt_dynar_foreach(smpi_bw_factor, iter, fact) {
     if (size <= fact.factor) {
-      XBT_DEBUG("%lf <= %ld return %f", size, fact.factor, current);
+      XBT_DEBUG("%f <= %ld return %f", size, fact.factor, current);
       return current;
     }else
       current=fact.value;
   }
-  XBT_DEBUG("%lf > %ld return %f", size, fact.factor, current);
+  XBT_DEBUG("%f > %ld return %f", size, fact.factor, current);
 
   return current;
 }
@@ -147,12 +148,12 @@ static double smpi_latency_factor(double size)
   double current=1.0;
   xbt_dynar_foreach(smpi_lat_factor, iter, fact) {
     if (size <= fact.factor) {
-      XBT_DEBUG("%lf <= %ld return %f", size, fact.factor, current);
+      XBT_DEBUG("%f <= %ld return %f", size, fact.factor, current);
       return current;
     }else
       current=fact.value;
   }
-  XBT_DEBUG("%lf > %ld return %f", size, fact.factor, current);
+  XBT_DEBUG("%f > %ld return %f", size, fact.factor, current);
 
   return current;
 }
@@ -379,8 +380,8 @@ static void net_update_resource_state(void *id,
                                       double value, double date)
 {
   link_CM02_t nw_link = id;
-  /*   printf("[" "%lg" "] Asking to update network card \"%s\" with value " */
-  /*     "%lg" " for event %p\n", surf_get_clock(), nw_link->name, */
+  /*   printf("[" "%g" "] Asking to update network card \"%s\" with value " */
+  /*     "%g" " for event %p\n", surf_get_clock(), nw_link->name, */
   /*     value, event_type); */
 
   if (event_type == nw_link->lmm_resource.power.event) {
@@ -680,7 +681,7 @@ static void smpi_gap_append(double size, const link_CM02_t link,
 
   if (sg_sender_gap > 0.0) {
     if (!gap_lookup) {
-      gap_lookup = xbt_dict_new();
+      gap_lookup = xbt_dict_new_homogeneous(NULL);
     }
     fifo = (xbt_fifo_t) xbt_dict_get_or_null(gap_lookup, src);
     action->sender.gap = 0.0;