6 #ifndef BITCOIN_UINT256_H
7 #define BITCOIN_UINT256_H
20 template<
unsigned int BITS>
24 static constexpr
int WIDTH = BITS / 8;
26 static_assert(
WIDTH ==
sizeof(
m_data),
"Sanity check");
43 return std::all_of(
m_data.begin(),
m_data.end(), [](uint8_t val) {
59 std::string
GetHex()
const;
60 void SetHex(
const char* psz);
61 void SetHex(
const std::string& str);
64 constexpr
const unsigned char*
data()
const {
return m_data.data(); }
65 constexpr
unsigned char*
data() {
return m_data.data(); }
70 constexpr
const unsigned char*
begin()
const {
return m_data.data(); }
73 static constexpr
unsigned int size() {
return WIDTH; }
77 template<
typename Stream>
83 template<
typename Stream>
constexpr std::size_t size() const noexcept
constexpr C * end() const noexcept
constexpr C * begin() const noexcept
Template base class for fixed-sized opaque blobs.
constexpr base_blob(uint8_t v)
constexpr bool IsNull() const
constexpr unsigned char * end()
static constexpr int WIDTH
static constexpr unsigned int size()
void SetHex(const char *psz)
constexpr uint64_t GetUint64(int pos) const
void Unserialize(Stream &s)
std::string ToString() const
constexpr const unsigned char * data() const
constexpr const unsigned char * begin() const
constexpr friend bool operator!=(const base_blob &a, const base_blob &b)
constexpr friend bool operator<(const base_blob &a, const base_blob &b)
constexpr int Compare(const base_blob &other) const
constexpr unsigned char * begin()
constexpr friend bool operator==(const base_blob &a, const base_blob &b)
constexpr unsigned char * data()
void Serialize(Stream &s) const
constexpr const unsigned char * end() const
std::string GetHex() const
constexpr base_blob(Span< const unsigned char > vch)
std::array< uint8_t, WIDTH > m_data
constexpr uint160(Span< const unsigned char > vch)
constexpr uint160()=default
constexpr uint256(Span< const unsigned char > vch)
constexpr uint256()=default
static const uint256 ZERO
constexpr uint256(uint8_t v)
static uint64_t ReadLE64(const unsigned char *ptr)
Span< const std::byte > MakeByteSpan(V &&v) noexcept
Span< std::byte > MakeWritableByteSpan(V &&v) noexcept
uint256 uint256S(const char *str)