8 #ifndef INCLUDED_SDSL_UINT256
9 #define INCLUDED_SDSL_UINT256
43 : m_lo(std::move(x.m_lo))
44 , m_mid(std::move(x.m_mid))
45 , m_high(std::move(x.m_high))
58 m_lo = std::move(x.m_lo);
59 m_mid = std::move(x.m_mid);
60 m_high = std::move(x.m_high);
74 if (m_mid) {
return bits::hi(m_mid) + 64; }
82 uint64_t hh = (m_high >> 64);
83 if (hh) {
return bits::hi(hh) + 192; }
98 uint64_t hh = m_high >> 64;
111 m_high += x.m_high + (mid >> 64);
120 return uint256_t(lo, mid, m_high + x.m_high + (mid >> 64));
128 return uint256_t(lo, mid, m_high + (~x.m_high) + (mid >> 64));
138 m_high += (~x.m_high) + (mid >> 64);
144 return uint256_t(m_lo | x.m_lo, m_mid | x.m_mid, m_high | x.m_high);
157 return uint256_t(m_lo & x.m_lo, m_mid & x.m_mid, m_high & x.m_high);
171 high |= (low >> (128 - x));
187 low |= ((m_high << (127 - x)) << 1);
188 return uint256_t(low, low >> 64, m_high >> x);
207 return (m_lo == x.m_lo) and (m_mid == x.m_mid) and (m_high == x.m_high);
214 if (m_high != x.m_high) {
return m_high > x.m_high; }
215 if (m_mid != x.m_mid) {
return m_mid > x.m_mid; }
218 return m_lo >= x.m_lo;
224 if (m_high != x.m_high) {
return m_high < x.m_high; }
225 if (m_mid != x.m_mid) {
return m_mid < x.m_mid; }
228 return m_lo <= x.m_lo;
234 if (m_high != x.m_high) {
return m_high > x.m_high; }
235 if (m_mid != x.m_mid) {
return m_mid > x.m_mid; }
238 return m_lo > x.m_lo;
250 if (m_high != x.m_high) {
return m_high < x.m_high; }
251 if (m_mid != x.m_mid) {
return m_mid < x.m_mid; }
254 return m_lo < x.m_lo;
258 inline operator uint64_t() {
return m_lo; }
263 uint64_t X[4] = { (uint64_t)(x.m_high >> 64), (uint64_t)x.m_high, x.m_mid, x.m_lo };
264 for (
int j = 0; j < 4; ++j)
266 for (
int i = 0; i < 16; ++i)
268 os << std::hex << ((X[j] >> 60) & 0xFULL) << std::dec;
bits.hpp contains the sdsl::bits class.
uint256_t(uint64_t lo=0, uint64_t mid=0, uint128_t high=0)
uint256_t operator&(const uint256_t &x)
uint256_t operator>>(int x) const
bool operator>=(const uint256_t &x) const
bool operator>(const uint64_t &x) const
uint256_t & operator|=(const uint256_t &x)
uint256_t & operator=(uint256_t &&x)
uint256_t(const uint256_t &x)
friend std::ostream & operator<<(std::ostream &, const uint256_t &)
bool operator<(const uint256_t &x) const
uint256_t operator<<(int x) const
uint256_t & operator-=(const uint256_t &x)
uint256_t & operator=(const uint64_t &x)
bool operator==(const uint256_t &x) const
bool operator>(const uint256_t &x) const
uint16_t select(uint32_t i)
uint256_t operator|(const uint256_t &x)
bool operator!=(const uint256_t &x) const
uint256_t operator+(const uint256_t &x)
bool operator<=(const uint256_t &x) const
uint256_t operator-(const uint256_t &x)
uint256_t & operator+=(const uint256_t &x)
uint256_t & operator=(const uint256_t &x)
Namespace for the succinct data structure library.
std::ostream & operator<<(std::ostream &os, const bp_interval< t_int > &interval)
static SDSL_CONSTEXPR uint32_t sel(uint64_t x, uint32_t i)
Calculate the position of the i-th rightmost 1 bit in the 64bit integer x.
static SDSL_CONSTEXPR uint32_t hi(uint64_t x)
Position of the most significant set bit the 64-bit word x.
static SDSL_CONSTEXPR uint64_t cnt(uint64_t x)
Counts the number of set bits in x.
uint128_t.hpp contains contains the definition of a 128-bit unsigned integer type.