7 #ifndef RAVEN_UINT256_H 8 #define RAVEN_UINT256_H 19 template<
unsigned int BITS>
28 memset(data, 0,
sizeof(data));
31 explicit base_blob(
const std::vector<unsigned char>& vch);
35 for (
int i = 0; i <
WIDTH; i++)
43 memset(data, 0,
sizeof(data));
52 std::string
GetHex()
const;
53 void SetHex(
const char* psz);
54 void SetHex(
const std::string& str);
67 const unsigned char*
begin()
const 72 const unsigned char*
end()
const 84 const uint8_t* ptr = data + pos * 8;
85 return ((uint64_t)ptr[0]) | \
86 ((uint64_t)ptr[1]) << 8 | \
87 ((uint64_t)ptr[2]) << 16 | \
88 ((uint64_t)ptr[3]) << 24 | \
89 ((uint64_t)ptr[4]) << 32 | \
90 ((uint64_t)ptr[5]) << 40 | \
91 ((uint64_t)ptr[6]) << 48 | \
92 ((uint64_t)ptr[7]) << 56;
95 template<
typename Stream>
98 s.write((
char*)data,
sizeof(data));
101 template<
typename Stream>
104 s.read((
char*)data,
sizeof(data));
132 return(
data[index / 2] >> 4);
133 return(
data[index / 2] & 0x0F);
142 return ReadLE64(
data);
179 #endif // RAVEN_UINT256_H
int GetNibble(int index) const
const unsigned char * begin() const
friend bool operator==(const base_blob &a, const base_blob &b)
void Serialize(Stream &s) const
uint512(const base_blob< 512 > &b)
int Compare(const base_blob &other) const
uint512(const std::vector< unsigned char > &vch)
friend bool operator!=(const base_blob &a, const base_blob &b)
const unsigned char * end() const
uint256(const std::vector< unsigned char > &vch)
void Unserialize(Stream &s)
uint256 uint256S(const char *str)
friend bool operator<(const base_blob &a, const base_blob &b)
std::string ToString() const
unsigned int size() const
Template base class for fixed-sized opaque blobs.
void * memcpy(void *a, const void *b, size_t c)
std::string GetHex() const
uint160(const std::vector< unsigned char > &vch)
uint64_t GetCheapHash() const
A cheap hash function that just returns 64 bits from the result, it can be used when the contents are...
uint64_t GetUint64(int pos) const
void SetHex(const char *psz)