aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-07-23 15:44:04 +0000
committerlloyd <[email protected]>2007-07-23 15:44:04 +0000
commite2f1f734277146d817ab284dea21e4013cb5b937 (patch)
tree21ad6ee775e36aa7fb24a504077200c22b1f15b8 /src/util.cpp
parent211c4929ae92106794984d872a0cae1a873baa29 (diff)
Avoid C-style casts (as detected by GCC's -Wold-style-cast) and instead use
static_cast or reinterpret_cast, as needed.
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util.cpp b/src/util.cpp
index fec8cfe3d..2744f984a 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -40,10 +40,12 @@ u32bit dl_work_factor(u32bit n_bits)
const double log_x = n_bits / 1.44;
- u32bit estimate = (u32bit)(2.76 * std::pow(log_x, 1.0/3.0) *
- std::pow(std::log(log_x), 2.0/3.0));
+ const double strength =
+ 2.76 * std::pow(log_x, 1.0/3.0) * std::pow(std::log(log_x), 2.0/3.0);
- return std::max(estimate, MIN_ESTIMATE);
+ if(strength > MIN_ESTIMATE)
+ return static_cast<u32bit>(strength);
+ return MIN_ESTIMATE;
}
/*************************************************