A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cosmetics to please sonar
[simgrid.git]
/
teshsuite
/
smpi
/
macro-shared
/
macro-shared.c
diff --git
a/teshsuite/smpi/macro-shared/macro-shared.c
b/teshsuite/smpi/macro-shared/macro-shared.c
index
f3ac848
..
5c3ee9f
100644
(file)
--- a/
teshsuite/smpi/macro-shared/macro-shared.c
+++ b/
teshsuite/smpi/macro-shared/macro-shared.c
@@
-13,18
+13,22
@@
static void* hash(char *str, uint64_t* ans)
{
static void* hash(char *str, uint64_t* ans)
{
+ char *tohash = str;
*ans=5381;
*ans=5381;
- int c;
printf("hashing !\n");
printf("hashing !\n");
- while ((c = *str++)!=0)
+ int c = *(tohash++);
+ while (c != 0) {
*ans = ((*ans << 5) + *ans) + c; /* hash * 33 + c */
*ans = ((*ans << 5) + *ans) + c; /* hash * 33 + c */
+ c = *(tohash++);
+ }
return NULL;
}
int main(int argc, char *argv[])
{
MPI_Init(&argc, &argv);
return NULL;
}
int main(int argc, char *argv[])
{
MPI_Init(&argc, &argv);
- int rank, size;
+ int rank;
+ int size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
//Let's Allocate a shared memory buffer
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
//Let's Allocate a shared memory buffer
@@
-50,7
+54,6
@@
int main(int argc, char *argv[])
printf("[%d] After change, the value in the shared buffer is: %" PRIu64"\n", rank, *buf);
SMPI_SHARED_FREE(buf);
printf("[%d] After change, the value in the shared buffer is: %" PRIu64"\n", rank, *buf);
SMPI_SHARED_FREE(buf);
- buf=NULL;
free(str);
MPI_Finalize();
free(str);
MPI_Finalize();