Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #193 from Takishipp/signals
[simgrid.git] / teshsuite / smpi / macro-shared / macro-shared.c
index a9f1e56..1e09ac4 100644 (file)
@@ -15,12 +15,12 @@ static void* hash(char *str, uint64_t* ans)
 {
   char *tohash = str;
   *ans=5381;
-  int c;
   printf("hashing !\n");
-  c = *tohash++;
-  while (c!=0){
+  int c = *tohash;
+  while (c != 0) {
     *ans = ((*ans << 5) + *ans) + c; /* hash * 33 + c */
-    c = *tohash++;
+    tohash++;
+    c = *tohash;
   }
   return NULL;
 }
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
   //Try SMPI_SHARED_CALL function, which should call hash only once and for all.
   char *str = strdup("onceandforall");
   if(rank==size-1){
-    SMPI_SHARED_CALL(hash,str,str,buf);  
+    SMPI_SHARED_CALL(hash,str,str,buf);
   }
 
   MPI_Barrier(MPI_COMM_WORLD);