Revision: 107
http://adchpp.svn.sourceforge.net/adchpp/?rev=107&view=rev
Author: arnetheduck
Date: 2007-12-19 01:35:58 -0800 (Wed, 19 Dec 2007)
Log Message:
-----------
Fix k assignment error
Modified Paths:
--------------
adchpp/trunk/plugins/Bloom/src/HashBloom.cpp
Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.cpp
===================================================================
--- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-17 23:13:35 UTC (rev 106)
+++ adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-19 09:35:58 UTC (rev 107)
@@ -1,7 +1,6 @@
#include "stdinc.h"
#include "HashBloom.h"
-
size_t HashBloom::get_k(size_t n) {
const size_t bits = TTHValue::SIZE * 8;
for(size_t k = static_cast<size_t>(sqrt(bits)); k > 1; --k) {
@@ -18,7 +17,8 @@
uint64_t HashBloom::get_m(size_t n, size_t k) {
uint64_t m = (static_cast<uint64_t>(ceil(static_cast<double>(n) * k / log(2.))));
- return ((m / 8) + 1) * 8;
+ // 64-bit boundary allows us to use a bitset based on uint64_t's
+ return ((m / 64) + 1) * 64;
}
void HashBloom::add(const TTHValue& tth) {
@@ -45,7 +45,7 @@
void HashBloom::reset(size_t k_) {
bloom.resize(0);
- k = k;
+ k = k_;
}
size_t HashBloom::pos(const TTHValue& tth, size_t n) const {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|