6#ifndef BITCOIN_UINT256_H
7#define BITCOIN_UINT256_H
16template<
unsigned int BITS>
20 static constexpr int WIDTH = BITS / 8;
29 explicit base_blob(
const std::vector<unsigned char>& vch);
33 for (
int i = 0; i <
WIDTH; i++)
50 std::string
GetHex()
const;
51 void SetHex(
const char* psz);
52 void SetHex(
const std::string& str);
68 const unsigned char*
begin()
const
73 const unsigned char*
end()
const
78 static constexpr unsigned int size()
85 const uint8_t* ptr =
m_data + pos * 8;
86 return ((uint64_t)ptr[0]) | \
87 ((uint64_t)ptr[1]) << 8 | \
88 ((uint64_t)ptr[2]) << 16 | \
89 ((uint64_t)ptr[3]) << 24 | \
90 ((uint64_t)ptr[4]) << 32 | \
91 ((uint64_t)ptr[5]) << 40 | \
92 ((uint64_t)ptr[6]) << 48 | \
93 ((uint64_t)ptr[7]) << 56;
96 template<
typename Stream>
102 template<
typename Stream>
Template base class for fixed-sized opaque blobs.
const unsigned char * data() const
constexpr base_blob(uint8_t v)
const unsigned char * begin() const
static constexpr int WIDTH
static constexpr unsigned int size()
void SetHex(const char *psz)
void Unserialize(Stream &s)
int Compare(const base_blob &other) const
std::string ToString() const
friend bool operator!=(const base_blob &a, const base_blob &b)
const unsigned char * end() const
friend bool operator==(const base_blob &a, const base_blob &b)
void Serialize(Stream &s) const
std::string GetHex() const
uint64_t GetUint64(int pos) const
friend bool operator<(const base_blob &a, const base_blob &b)
uint160(const std::vector< unsigned char > &vch)
static const uint256 ZERO
uint256(const std::vector< unsigned char > &vch)
constexpr uint256(uint8_t v)
uint256 uint256S(const char *str)