more minor changes
authorGengbin Zheng <gzheng@illinois.edu>
Wed, 30 Mar 2011 17:09:17 +0000 (12:09 -0500)
committerGengbin Zheng <gzheng@illinois.edu>
Wed, 30 Mar 2011 17:09:17 +0000 (12:09 -0500)
src/ck-ldb/tm_bucket.c
src/ck-ldb/tm_mapping.c
src/ck-ldb/tm_tree.c

index a2748ad744b28958bea5700288e50dfa114302ca..20dfb47d16a15d09f8373aa2d6b304c003ae6caa 100644 (file)
 #include <winbase.h>
 #define random() rand()
 #define srandom(x)  srand(x)
-#define strsep     strtok
+#endif
+
+#if __CHARMC__
+#include "converse.h"
 #endif
 
 #undef DEBUG
@@ -178,7 +181,7 @@ void  built_pivot_tree(bucket_list_t bucket_list){
   pivot=bucket_list->pivot;
   n=bucket_list->nb_buckets;
   pivot_tree=(double*)malloc(sizeof(double)*2*n);
-  bucket_list->max_depth=(int)log2(n);
+  bucket_list->max_depth=(int)CmiLog2(n);
 
   dfs(1,1,n-1,pivot,pivot_tree,0,bucket_list->max_depth);
 
index f0deb290f9ca48a1e7249e77951d0446deecaa1a..435e8a4e7fbd32213e7715a7a80cc6f29dac2aac 100644 (file)
@@ -14,7 +14,6 @@
 #include <winbase.h>
 #define random() rand()
 #define srandom(x)  srand(x)
-#define strsep(x,y)     strtok(*x, y)
 #endif
  
 #define TEST_ERROR(n) {if(n!=0){fprintf(stderr,"Error %d Line %d\n",n,__LINE__);exit(-1);}}
@@ -126,7 +125,7 @@ void init_comm(char *filename,int N,double **comm){
     char *l=line;
     j=0;
     //printf("%s|",line);
-    while((ptr=strsep(&l," \t"))){
+    while((ptr=strtok(l," \t"))){
       if((ptr[0]!='\n')&&(!isspace(ptr[0]))&&(*ptr)){
        comm[i][j]=atof(ptr);
        //printf ("comm[%d][%d]=%f|%s|\n",i,j,comm[i][j],ptr);
index 9ad079bd305aa56e4c12ce5818849d17017ce1c1..5807fa86dcba5576d17bcc402450b8db6140e8d6 100644 (file)
@@ -7,6 +7,10 @@
 #include "tm_timings.h"
 #include "tm_bucket.h"
 
+#if __CHARMC__
+#include "converse.h"
+#endif
+
 #define MIN(a,b) ((a)<(b)?(a):(b))
 #define MAX(a,b) ((a)>(b)?(a):(b))
 #undef DEBUG
@@ -681,7 +685,7 @@ void fast_grouping(double **tab,tree_t *tab_node, tree_t *new_tab_node, int arit
     //printf("k%d/%d, k=%ld\n",l,M,k);
     /* select the best greedy grouping among the 10 first one*/
     //fast_group(tab,tab_node,&new_tab_node[l],-1,arity,0,&best_val,cur_group,N,&nb_groups,MAX(2,(int)(50-log2(k))-M/10));
-    fast_group(tab,tab_node,&new_tab_node[l],-1,arity,0,&best_val,cur_group,N,&nb_groups,MAX(1,(int)(50-log2(k))-M/10));
+    fast_group(tab,tab_node,&new_tab_node[l],-1,arity,0,&best_val,cur_group,N,&nb_groups,MAX(1,(int)(50-CmiLog2(k))-M/10));
     val+=best_val;
     for(i=0;i<new_tab_node[l].arity;i++){
       new_tab_node[l].child[i]->parent=&new_tab_node[l];