diff options
| author | João Barbosa <[email protected]> | 2019-05-21 23:47:44 +0100 |
|---|---|---|
| committer | João Barbosa <[email protected]> | 2019-05-22 15:55:50 +0100 |
| commit | df9e15f092c18a8047f09307576c2b77b9c8d01c (patch) | |
| tree | 2412fc409049d3528ee5339c9adee9c01f8dd20a /src | |
| parent | bench: Add benchmark for CRollingBloomFilter::reset (diff) | |
| download | discoin-df9e15f092c18a8047f09307576c2b77b9c8d01c.tar.xz discoin-df9e15f092c18a8047f09307576c2b77b9c8d01c.zip | |
refactor: Improve CRollingBloomFilter::reset by using std::fill
Diffstat (limited to 'src')
| -rw-r--r-- | src/bloom.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/bloom.cpp b/src/bloom.cpp index 7732cee27..a06192508 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -14,6 +14,7 @@ #include <math.h> #include <stdlib.h> +#include <algorithm> #define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455 #define LN2 0.6931471805599453094172321214581765680755001343602552 @@ -304,7 +305,5 @@ void CRollingBloomFilter::reset() nTweak = GetRand(std::numeric_limits<unsigned int>::max()); nEntriesThisGeneration = 0; nGeneration = 1; - for (std::vector<uint64_t>::iterator it = data.begin(); it != data.end(); it++) { - *it = 0; - } + std::fill(data.begin(), data.end(), 0); } |