Changeset View
Changeset View
Standalone View
Standalone View
src/uint256.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <uint256.h> | #include <uint256.h> | ||||
#include <utilstrencodings.h> | #include <utilstrencodings.h> | ||||
#include <cstdio> | #include <cstdio> | ||||
#include <cstring> | #include <cstring> | ||||
template <unsigned int BITS> | template <unsigned int BITS> | ||||
base_blob<BITS>::base_blob(const std::vector<uint8_t> &vch) { | base_blob<BITS>::base_blob(const std::vector<uint8_t> &vch) { | ||||
assert(vch.size() == sizeof(data)); | assert(vch.size() == sizeof(data)); | ||||
memcpy(data, &vch[0], sizeof(data)); | memcpy(data, vch.data(), sizeof(data)); | ||||
} | } | ||||
template <unsigned int BITS> std::string base_blob<BITS>::GetHex() const { | template <unsigned int BITS> std::string base_blob<BITS>::GetHex() const { | ||||
return HexStr(std::reverse_iterator<const uint8_t *>(data + sizeof(data)), | return HexStr(std::reverse_iterator<const uint8_t *>(data + sizeof(data)), | ||||
std::reverse_iterator<const uint8_t *>(data)); | std::reverse_iterator<const uint8_t *>(data)); | ||||
} | } | ||||
template <unsigned int BITS> void base_blob<BITS>::SetHex(const char *psz) { | template <unsigned int BITS> void base_blob<BITS>::SetHex(const char *psz) { | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |