diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-11 21:57:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-11 21:57:37 +0000 |
commit | 719fb963b47d487112879ff2cb9d10cff88b84f5 (patch) | |
tree | 52f3b24fa1c69251ba451fc28d6dfd3cde250ed3 /src/testing | |
parent | ac5f48c0d9c409e3cb7400b9650dc5994cdc59ae (diff) | |
download | gnunet-719fb963b47d487112879ff2cb9d10cff88b84f5.tar.gz gnunet-719fb963b47d487112879ff2cb9d10cff88b84f5.zip |
use constants instead of casting -1
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing_group.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 7afbbd48b..4f369812d 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -726,7 +726,7 @@ create_scale_free (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connectio | |||
726 | { | 726 | { |
727 | probability = pg->peers[i].num_connections / (double)previous_total_connections; | 727 | probability = pg->peers[i].num_connections / (double)previous_total_connections; |
728 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 728 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
729 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 729 | UINT64_MAX)) / ( (double) UINT64_MAX); |
730 | #if VERBOSE_TESTING | 730 | #if VERBOSE_TESTING |
731 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 731 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
732 | "Considering connecting peer %d to peer %d\n", | 732 | "Considering connecting peer %d to peer %d\n", |
@@ -820,7 +820,7 @@ create_small_world_ring(struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Conn | |||
820 | for (j = 0; j < connsPerPeer / 2; j++) | 820 | for (j = 0; j < connsPerPeer / 2; j++) |
821 | { | 821 | { |
822 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 822 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
823 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 823 | UINT64_MAX) / ( (double) UINT64_MAX)); |
824 | if (random < percentage) | 824 | if (random < percentage) |
825 | { | 825 | { |
826 | /* Connect to uniformly selected random peer */ | 826 | /* Connect to uniformly selected random peer */ |
@@ -1035,7 +1035,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1035 | probability = 1.0 / (distance * distance); | 1035 | probability = 1.0 / (distance * distance); |
1036 | /* Choose a random value between 0 and 1 */ | 1036 | /* Choose a random value between 0 and 1 */ |
1037 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 1037 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
1038 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 1038 | UINT64_MAX)) / ( (double) UINT64_MAX); |
1039 | /* If random < probability, then connect the two nodes */ | 1039 | /* If random < probability, then connect the two nodes */ |
1040 | if (random < probability) | 1040 | if (random < probability) |
1041 | smallWorldConnections += proc (pg, j, k); | 1041 | smallWorldConnections += proc (pg, j, k); |
@@ -1086,7 +1086,7 @@ create_erdos_renyi (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1086 | inner_count++) | 1086 | inner_count++) |
1087 | { | 1087 | { |
1088 | temp_rand = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 1088 | temp_rand = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
1089 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 1089 | UINT64_MAX)) / ( (double) UINT64_MAX); |
1090 | #if VERBOSE_TESTING | 1090 | #if VERBOSE_TESTING |
1091 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1091 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1092 | _("rand is %f probability is %f\n"), temp_rand, | 1092 | _("rand is %f probability is %f\n"), temp_rand, |
@@ -2077,7 +2077,7 @@ random_connect_iterator (void *cls, | |||
2077 | uint32_t second_pos; | 2077 | uint32_t second_pos; |
2078 | GNUNET_HashCode first_hash; | 2078 | GNUNET_HashCode first_hash; |
2079 | random_number = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 2079 | random_number = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
2080 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 2080 | UINT64_MAX)) / ( (double) UINT64_MAX); |
2081 | if (random_number < random_ctx->percentage) | 2081 | if (random_number < random_ctx->percentage) |
2082 | { | 2082 | { |
2083 | GNUNET_assert(GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(random_ctx->first->connect_peers_working_set, key, value, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 2083 | GNUNET_assert(GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(random_ctx->first->connect_peers_working_set, key, value, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |