From: Julius Bünger Date: Sun, 24 Jun 2018 15:40:29 +0000 (+0200) Subject: rps profiler: correct computation of needed bits X-Git-Tag: v0.11.0~357^2~34^2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=74f60ad005132f12f3593abfe78c8aa537183b34;p=oweals%2Fgnunet.git rps profiler: correct computation of needed bits --- diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index a0e79e565..ef67aa949 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c @@ -2635,12 +2635,12 @@ run (void *cls, } /* Compute number of bits for representing largest peer id */ - for (bits_needed = 1; (bits_needed << 1) < num_peers - 1; bits_needed++) + for (bits_needed = 1; (1 << bits_needed) < num_peers; bits_needed++) ; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Need %u bits to represent largest peer id %" PRIu32 "\n", + "Need %u bits to represent %" PRIu32 " peers\n", bits_needed, - num_peers - 1); + num_peers); rps_peers = GNUNET_new_array (num_peers, struct RPSPeer); peer_map = GNUNET_CONTAINER_multipeermap_create (num_peers, GNUNET_NO);