mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
param variables made const
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
|
||||
#define LN2 0.6931471805599453094172321214581765680755001343602552
|
||||
|
||||
CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweakIn, unsigned char nFlagsIn) :
|
||||
CBloomFilter::CBloomFilter(const unsigned int nElements, const double nFPRate, const unsigned int nTweakIn, unsigned char nFlagsIn) :
|
||||
/**
|
||||
* The ideal size for a bloom filter with a given number of elements and false positive rate is:
|
||||
* - nElements * log(fp rate) / ln(2)^2
|
||||
@@ -40,7 +40,7 @@ CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int
|
||||
}
|
||||
|
||||
// Private constructor used by CRollingBloomFilter
|
||||
CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweakIn) :
|
||||
CBloomFilter::CBloomFilter(const unsigned int nElements, const double nFPRate, const unsigned int nTweakIn) :
|
||||
vData((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)) / 8),
|
||||
isFull(false),
|
||||
isEmpty(true),
|
||||
@@ -120,7 +120,7 @@ void CBloomFilter::clear()
|
||||
isEmpty = true;
|
||||
}
|
||||
|
||||
void CBloomFilter::reset(unsigned int nNewTweak)
|
||||
void CBloomFilter::reset(const unsigned int nNewTweak)
|
||||
{
|
||||
clear();
|
||||
nTweak = nNewTweak;
|
||||
@@ -214,7 +214,7 @@ void CBloomFilter::UpdateEmptyFull()
|
||||
isEmpty = empty;
|
||||
}
|
||||
|
||||
CRollingBloomFilter::CRollingBloomFilter(unsigned int nElements, double fpRate)
|
||||
CRollingBloomFilter::CRollingBloomFilter(const unsigned int nElements, const double fpRate)
|
||||
{
|
||||
double logFpRate = log(fpRate);
|
||||
/* The optimal number of hash functions is log(fpRate) / log(0.5), but
|
||||
|
||||
Reference in New Issue
Block a user