diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2018-06-18 07:58:28 +0200 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2018-08-27 18:19:33 +0200 |
commit | f34c8c466a0e514edac2e8683127b4176ad5d321 (patch) | |
tree | 587ba001d5d6eaae71d234009098710dd30354c3 /src/bech32.cpp | |
parent | f180e81d5780805a28bcc71c2bb6b16076336c3c (diff) |
Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
Diffstat (limited to 'src/bech32.cpp')
-rw-r--r-- | src/bech32.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bech32.cpp b/src/bech32.cpp index c55f22b9b7..d6b29391a9 100644 --- a/src/bech32.cpp +++ b/src/bech32.cpp @@ -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; |