aboutsummaryrefslogtreecommitdiff
path: root/src/bech32.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2019-08-28 15:12:51 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2019-10-16 08:56:57 -0700
commite65e61c812df90a56e3ce4a8e76c4b746766f387 (patch)
tree787fa4b641ed0d640f96cf430092961e9d7b1b20 /src/bech32.cpp
parentc34b88620dc8435b83e6744895f2ecd3c9ec8de7 (diff)
downloadbitcoin-e65e61c812df90a56e3ce4a8e76c4b746766f387.tar.xz
Add some general std::vector utility functions
Added are: * Vector(arg1,arg2,arg3,...) constructs a vector with the specified arguments as elements. The vector's type is derived from the arguments. If some of the arguments are rvalue references, they will be moved into place rather than copied (which can't be achieved using list initialization). * Cat(vector1,vector2) returns a concatenation of the two vectors, efficiently moving elements when relevant. Vector generalizes (and replaces) the Singleton function in src/descriptor.cpp, and Cat replaces the Cat function in bech32.cpp
Diffstat (limited to 'src/bech32.cpp')
-rw-r--r--src/bech32.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/bech32.cpp b/src/bech32.cpp
index 4c966350b4..1e0471f110 100644
--- a/src/bech32.cpp
+++ b/src/bech32.cpp
@@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bech32.h>
+#include <util/vector.h>
#include <assert.h>
@@ -26,13 +27,6 @@ const int8_t CHARSET_REV[128] = {
1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1
};
-/** Concatenate two byte arrays. */
-data Cat(data x, const data& y)
-{
- x.insert(x.end(), y.begin(), y.end());
- return x;
-}
-
/** This function will compute what 6 5-bit values to XOR into the last 6 input values, in order to
* make the checksum 0. These 6 values are packed together in a single 30-bit integer. The higher
* bits correspond to earlier values. */