aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-09-29 09:43:37 +0800
committerfanquake <fanquake@gmail.com>2021-09-29 09:43:37 +0800
commitf1ed1d3194d4160923f3b02fa1acffd805ab4428 (patch)
tree35561332407619818448c4c3960fab253259ea02
parent2ba4ddf31d27bebc144b3729479967b40bbe0b6a (diff)
downloadbitcoin-f1ed1d3194d4160923f3b02fa1acffd805ab4428.tar.xz
bloom: use constexpr where appropriate
-rw-r--r--src/bloom.cpp4
-rw-r--r--src/bloom.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/bloom.cpp b/src/bloom.cpp
index 78ef1897c9..20722c8d5c 100644
--- a/src/bloom.cpp
+++ b/src/bloom.cpp
@@ -16,8 +16,8 @@
#include <algorithm>
-#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
-#define LN2 0.6931471805599453094172321214581765680755001343602552
+static constexpr double LN2SQUARED = 0.4804530139182014246671025263266649717305529515945455;
+static constexpr double LN2 = 0.6931471805599453094172321214581765680755001343602552;
CBloomFilter::CBloomFilter(const unsigned int nElements, const double nFPRate, const unsigned int nTweakIn, unsigned char nFlagsIn) :
/**
diff --git a/src/bloom.h b/src/bloom.h
index 391e2cc888..67177c6daa 100644
--- a/src/bloom.h
+++ b/src/bloom.h
@@ -13,8 +13,8 @@ class COutPoint;
class CTransaction;
//! 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
-static const unsigned int MAX_BLOOM_FILTER_SIZE = 36000; // bytes
-static const unsigned int MAX_HASH_FUNCS = 50;
+static constexpr unsigned int MAX_BLOOM_FILTER_SIZE = 36000; // bytes
+static constexpr unsigned int MAX_HASH_FUNCS = 50;
/**
* First two bits of nFlags control how much IsRelevantAndUpdate actually updates