From: David Barksdale Date: Fri, 1 Oct 2010 17:42:50 +0000 (+0000) Subject: FreeBSD 7 does not have log2. X-Git-Tag: initial-import-from-subversion-38251~20225 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=45648b6f956607b859b77bdb82563df094aa2516;p=oweals%2Fgnunet.git FreeBSD 7 does not have log2. --- diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index 52d51ecb9..66facaa53 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c @@ -2731,11 +2731,11 @@ converge_distance (const GNUNET_HashCode *target, return 1; } - /* Take the log (base 2) of the number of bits matching the other peer */ - exponent = log2(other_matching_bits); + /* Take the log (base e) of the number of bits matching the other peer */ + exponent = log(other_matching_bits); - /* Check if we would overflow; our largest possible value is 2^64 */ - if (exponent * calc_value >= 64) + /* Check if we would overflow; our largest possible value is 2^64 = e^44.361419555836498 */ + if (exponent * calc_value >= 44.361419555836498) return ULLONG_MAX; /* Clear errno and all math exceptions */