Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cast to the proper pointer type to avoid some warnings
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 13 Mar 2007 11:08:21 +0000 (11:08 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 13 Mar 2007 11:08:21 +0000 (11:08 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3247 48e7efb5-ca39-0410-a469-dd3cf9ba447f

testsuite/xbt/heap_bench.c

index ca64029..a18402b 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <time.h>
 
 #include "xbt/heap.h"
 #include "gras/virtu.h"                /* time manipulation in bench */
@@ -47,12 +48,13 @@ int compare_double(const void *a, const void *b)
 void test_heap_validity(int size)
 {
   xbt_heap_t heap = xbt_heap_new(size, NULL);
-  double *tab = calloc(size, sizeof(double));
+  double *tab = (double*)calloc(size,sizeof(double));
+
   int i;
 
   for (i = 0; i < size; i++) {
-    tab[i] = (10.0 * rand() / (RAND_MAX + 1.0));
-    xbt_heap_push(heap, NULL, tab[i]);
+    tab[i] = (double)(10.0 * rand() / (RAND_MAX + 1.0));
+    xbt_heap_push(heap, NULL, (double)tab[i]);
   }
 
   qsort(tab, size, sizeof(double), compare_double);
@@ -80,6 +82,7 @@ void test_heap_mean_operation(int size)
   date = gras_os_time() * 1000000;
   for (i = 0; i < size; i++)
     xbt_heap_push(heap, NULL, (10.0 * rand() / (RAND_MAX + 1.0)));
+
   date = gras_os_time() * 1000000 - date;
   printf("Creation time  %d size heap : %g\n", size, date);