1- <<<<<<< HEAD:src/bloom.cpp
2- // Copyright (c) 2012-2020 The Bitcoin Core developers
3- // Copyright (c) 2014-2020 The DigiByte Core developers
4- =======
51// Copyright (c) 2012-2022 The DigiByte Core developers
6- >>>>>>> bitcoin-v26-2 -converted/digibyte-v26.2 -naming-conversion:src/common/bloom.cpp
72// Distributed under the MIT software license, see the accompanying
83// file COPYING or http://www.opensource.org/licenses/mit-license.php.
94
2419#include < limits>
2520#include < vector>
2621
27- <<<<<<< HEAD:src/bloom.cpp
28- #include < algorithm>
29-
30- #define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
31- #define LN2 0.6931471805599453094172321214581765680755001343602552
32- =======
3322static constexpr double LN2SQUARED = 0.4804530139182014246671025263266649717305529515945455 ;
3423static constexpr double LN2 = 0.6931471805599453094172321214581765680755001343602552 ;
35- >>>>>>> bitcoin-v26-2 -converted/digibyte-v26.2 -naming-conversion:src/common/bloom.cpp
3624
3725CBloomFilter::CBloomFilter (const unsigned int nElements, const double nFPRate, const unsigned int nTweakIn, unsigned char nFlagsIn) :
3826 /* *
@@ -52,11 +40,7 @@ CBloomFilter::CBloomFilter(const unsigned int nElements, const double nFPRate, c
5240{
5341}
5442
55- <<<<<<< HEAD:src/bloom.cpp
56- inline unsigned int CBloomFilter::Hash (unsigned int nHashNum, const std::vector<unsigned char >& vDataToHash) const
57- =======
5843inline unsigned int CBloomFilter::Hash (unsigned int nHashNum, Span<const unsigned char > vDataToHash) const
59- >>>>>>> bitcoin-v26-2-converted/digibyte-v26.2-naming-conversion:src/common/bloom.cpp
6044{
6145 // 0xFBA4C795 chosen as it guarantees a reasonable bit difference between nHashNum values.
6246 return MurmurHash3 (nHashNum * 0xFBA4C795 + nTweak, vDataToHash) % (vData.size () * 8 );
@@ -83,15 +67,6 @@ void CBloomFilter::insert(const COutPoint& outpoint)
8367
8468bool CBloomFilter::contains (Span<const unsigned char > vKey) const
8569{
86- <<<<<<< HEAD:src/bloom.cpp
87- std::vector<unsigned char > data (hash.begin (), hash.end ());
88- insert (data);
89- }
90-
91- bool CBloomFilter::contains (const std::vector<unsigned char >& vKey) const
92- {
93- =======
94- >>>>>>> bitcoin-v26-2 -converted/digibyte-v26.2 -naming-conversion:src/common/bloom.cpp
9570 if (vData.empty ()) // Avoid divide-by-zero (CVE-2013-5700)
9671 return true ;
9772 for (unsigned int i = 0 ; i < nHashFuncs; i++)
@@ -108,18 +83,7 @@ bool CBloomFilter::contains(const COutPoint& outpoint) const
10883{
10984 DataStream stream{};
11085 stream << outpoint;
111- <<<<<<< HEAD:src/bloom.cpp
112- std::vector<unsigned char > data (stream.begin (), stream.end ());
113- return contains (data);
114- }
115-
116- bool CBloomFilter::contains (const uint256& hash) const
117- {
118- std::vector<unsigned char > data (hash.begin (), hash.end ());
119- return contains (data);
120- =======
12186 return contains (MakeUCharSpan (stream));
122- >>>>>>> bitcoin-v26-2 -converted/digibyte-v26.2 -naming-conversion:src/common/bloom.cpp
12387}
12488
12589bool CBloomFilter::IsWithinSizeConstraints () const
0 commit comments