Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.

This commit is contained in:
practicalswift
2018-06-18 07:58:28 +02:00
parent f180e81d57
commit f34c8c466a
36 changed files with 77 additions and 77 deletions

View File

@@ -62,7 +62,7 @@ uint32_t PolyMod(const data& v)
// v, it corresponds to x^2 + v0*x + v1 mod g(x). As 1 mod g(x) = 1, that is the starting value
// for `c`.
uint32_t c = 1;
for (auto v_i : v) {
for (const auto v_i : v) {
// We want to update `c` to correspond to a polynomial with one extra term. If the initial
// value of `c` consists of the coefficients of c(x) = f(x) mod g(x), we modify it to
// correspond to c'(x) = (f(x) * x + v_i) mod g(x), where v_i is the next input to
@@ -149,7 +149,7 @@ std::string Encode(const std::string& hrp, const data& values) {
data combined = Cat(values, checksum);
std::string ret = hrp + '1';
ret.reserve(ret.size() + combined.size());
for (auto c : combined) {
for (const auto c : combined) {
ret += CHARSET[c];
}
return ret;