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++) {
59 return a.Compare(
b) == 0;
62 return a.Compare(
b) != 0;
65 return a.Compare(
b) < 0;
68 return a.Compare(
b) <= 0;
71 return a.Compare(
b) > 0;
74 return a.Compare(
b) >= 0;
77 std::string
GetHex()
const;
79 void SetHex(
const std::string &str);
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)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
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 *.