6#ifndef BITCOIN_UINT256_H
7#define BITCOIN_UINT256_H
20 static constexpr int WIDTH = BITS / 8;
30 explicit base_blob(
const std::vector<uint8_t> &vch);
33 for (
int i = 0; i <
WIDTH; i++) {
44 for (
size_t i = 0; i <
sizeof(
m_data); i++) {
77 std::string
GetHex()
const;
78 void SetHex(
const char *psz);
79 void SetHex(
const std::string &str);
96 const uint8_t *ptr =
m_data + pos * 8;
97 return uint64_t(ptr[0]) | (uint64_t(ptr[1]) << 8) |
98 (uint64_t(ptr[2]) << 16) | (uint64_t(ptr[3]) << 24) |
99 (uint64_t(ptr[4]) << 32) | (uint64_t(ptr[5]) << 40) |
100 (uint64_t(ptr[6]) << 48) | (uint64_t(ptr[7]) << 56);
103 template <
typename Stream>
void Serialize(Stream &s)
const {
Template base class for fixed-sized opaque blobs.
unsigned int size() const
constexpr base_blob(uint8_t v)
friend bool operator<=(const base_blob &a, const base_blob &b)
const uint8_t * end() const
static constexpr int WIDTH
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)
friend bool operator>=(const base_blob &a, const base_blob &b)
friend bool operator==(const base_blob &a, const base_blob &b)
void Serialize(Stream &s) const
const uint8_t * data() const
friend bool operator>(const base_blob &a, const base_blob &b)
std::string GetHex() const
const uint8_t * begin() const
uint64_t GetUint64(int pos) const
friend bool operator<(const base_blob &a, const base_blob &b)
uint160(const std::vector< uint8_t > &vch)
uint256(const std::vector< uint8_t > &vch)
static const uint256 ZERO
constexpr uint256(uint8_t v)
Span< const std::byte > MakeByteSpan(V &&v) noexcept
Span< std::byte > MakeWritableByteSpan(V &&v) noexcept
uint160 uint160S(const char *str)
uint256 uint256S(const char *str)
uint256 from const char *.