Skip to content

Commit

Permalink
Don't reimplement map default value behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Dec 11, 2021
1 parent 8bb19a6 commit afac50a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 1 addition & 6 deletions src/qinterface/qinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,12 +858,7 @@ std::map<bitCapInt, int> QInterface::MultiShotMeasureMask(
}
}

auto result = results.find(dist);
if (result == results.end()) {
results[dist] = 1;
} else {
result->second++;
}
results[dist]++;
}

return results;
Expand Down
7 changes: 1 addition & 6 deletions src/qunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1319,12 +1319,7 @@ real1_f QUnit::ProbParity(const bitCapInt& mask)

RevertBasis1Qb(qIndices[i]);

auto unit = units.find(shard.unit);
if (unit == units.end()) {
units[shard.unit] = pow2(shard.mapped);
} else {
unit->second |= pow2(shard.mapped);
}
units[shard.unit] |= pow2(shard.mapped);
}

if (qIndices.size() == 0) {
Expand Down

0 comments on commit afac50a

Please sign in to comment.