Remove redundant assignments (dead stores)

pull/643/head
practicalswift 6 years ago
parent e577669062
commit cdf4089457

@ -80,18 +80,16 @@ static void SipHash_32b(benchmark::State& state)
static void FastRandom_32bit(benchmark::State& state) static void FastRandom_32bit(benchmark::State& state)
{ {
FastRandomContext rng(true); FastRandomContext rng(true);
uint32_t x = 0;
while (state.KeepRunning()) { while (state.KeepRunning()) {
x += rng.rand32(); rng.rand32();
} }
} }
static void FastRandom_1bit(benchmark::State& state) static void FastRandom_1bit(benchmark::State& state)
{ {
FastRandomContext rng(true); FastRandomContext rng(true);
uint32_t x = 0;
while (state.KeepRunning()) { while (state.KeepRunning()) {
x += rng.randbool(); rng.randbool();
} }
} }

@ -12,7 +12,6 @@ static void RollingBloom(benchmark::State& state)
CRollingBloomFilter filter(120000, 0.000001); CRollingBloomFilter filter(120000, 0.000001);
std::vector<unsigned char> data(32); std::vector<unsigned char> data(32);
uint32_t count = 0; uint32_t count = 0;
uint64_t match = 0;
while (state.KeepRunning()) { while (state.KeepRunning()) {
count++; count++;
data[0] = count; data[0] = count;
@ -25,7 +24,7 @@ static void RollingBloom(benchmark::State& state)
data[1] = count >> 16; data[1] = count >> 16;
data[2] = count >> 8; data[2] = count >> 8;
data[3] = count; data[3] = count;
match += filter.contains(data); filter.contains(data);
} }
} }

@ -937,17 +937,19 @@ BOOST_AUTO_TEST_CASE(script_build)
} }
} }
#ifdef UPDATE_JSON_TESTS
std::string strGen; std::string strGen;
#endif
for (TestBuilder& test : tests) { for (TestBuilder& test : tests) {
test.Test(); test.Test();
std::string str = JSONPrettyPrint(test.GetJSON()); std::string str = JSONPrettyPrint(test.GetJSON());
#ifndef UPDATE_JSON_TESTS #ifdef UPDATE_JSON_TESTS
strGen += str + ",\n";
#else
if (tests_set.count(str) == 0) { if (tests_set.count(str) == 0) {
BOOST_CHECK_MESSAGE(false, "Missing auto script_valid test: " + test.GetComment()); BOOST_CHECK_MESSAGE(false, "Missing auto script_valid test: " + test.GetComment());
} }
#endif #endif
strGen += str + ",\n";
} }
#ifdef UPDATE_JSON_TESTS #ifdef UPDATE_JSON_TESTS

@ -640,8 +640,6 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
innerUsage += memusage::DynamicUsage(links.parents) + memusage::DynamicUsage(links.children); innerUsage += memusage::DynamicUsage(links.parents) + memusage::DynamicUsage(links.children);
bool fDependsWait = false; bool fDependsWait = false;
setEntries setParentCheck; setEntries setParentCheck;
int64_t parentSizes = 0;
int64_t parentSigOpCost = 0;
for (const CTxIn &txin : tx.vin) { for (const CTxIn &txin : tx.vin) {
// Check that every mempool transaction's inputs refer to available coins, or other mempool tx's. // Check that every mempool transaction's inputs refer to available coins, or other mempool tx's.
indexed_transaction_set::const_iterator it2 = mapTx.find(txin.prevout.hash); indexed_transaction_set::const_iterator it2 = mapTx.find(txin.prevout.hash);
@ -649,10 +647,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
const CTransaction& tx2 = it2->GetTx(); const CTransaction& tx2 = it2->GetTx();
assert(tx2.vout.size() > txin.prevout.n && !tx2.vout[txin.prevout.n].IsNull()); assert(tx2.vout.size() > txin.prevout.n && !tx2.vout[txin.prevout.n].IsNull());
fDependsWait = true; fDependsWait = true;
if (setParentCheck.insert(it2).second) { setParentCheck.insert(it2);
parentSizes += it2->GetTxSize();
parentSigOpCost += it2->GetSigOpCost();
}
} else { } else {
assert(pcoins->HaveCoin(txin.prevout)); assert(pcoins->HaveCoin(txin.prevout));
} }

Loading…
Cancel
Save