8#ifndef INCLUDED_SDSL_UINT256
9#define INCLUDED_SDSL_UINT256
32 inline uint256_t(uint64_t lo = 0, uint64_t mid = 0,
uint128_t high = 0) : m_lo(lo), m_mid(mid), m_high(high)
38 inline uint256_t(
uint256_t && x) : m_lo(std::move(x.m_lo)), m_mid(std::move(x.m_mid)), m_high(std::move(x.m_high))
51 m_lo = std::move(x.m_lo);
52 m_mid = std::move(x.m_mid);
53 m_high = std::move(x.m_high);
78 uint64_t hh = (m_high >> 64);
98 if ((x = (uint16_t)
bits::cnt(m_mid)) >= i)
103 uint64_t hh = m_high >> 64;
104 uint64_t lh = m_high;
119 m_high += x.m_high + (mid >> 64);
128 return uint256_t(lo, mid, m_high + x.m_high + (mid >> 64));
136 return uint256_t(lo, mid, m_high + (~x.m_high) + (mid >> 64));
146 m_high += (~x.m_high) + (mid >> 64);
152 return uint256_t(m_lo | x.m_lo, m_mid | x.m_mid, m_high | x.m_high);
165 return uint256_t(m_lo & x.m_lo, m_mid & x.m_mid, m_high & x.m_high);
179 high |= (low >> (128 - x));
195 low |= ((m_high << (127 - x)) << 1);
196 return uint256_t(low, low >> 64, m_high >> x);
215 return (m_lo == x.m_lo) and (m_mid == x.m_mid) and (m_high == x.m_high);
220 return !(*
this == x);
225 if (m_high != x.m_high)
227 return m_high > x.m_high;
229 if (m_mid != x.m_mid)
231 return m_mid > x.m_mid;
235 return m_lo >= x.m_lo;
241 if (m_high != x.m_high)
243 return m_high < x.m_high;
245 if (m_mid != x.m_mid)
247 return m_mid < x.m_mid;
251 return m_lo <= x.m_lo;
257 if (m_high != x.m_high)
259 return m_high > x.m_high;
261 if (m_mid != x.m_mid)
263 return m_mid > x.m_mid;
267 return m_lo > x.m_lo;
282 if (m_high != x.m_high)
284 return m_high < x.m_high;
286 if (m_mid != x.m_mid)
288 return m_mid < x.m_mid;
292 return m_lo < x.m_lo;
296 inline operator uint64_t()
304 uint64_t X[4] = {(uint64_t)(x.m_high >> 64), (uint64_t)x.m_high, x.m_mid, x.m_lo};
305 for (
int j = 0; j < 4; ++j)
307 for (
int i = 0; i < 16; ++i)
309 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)
bool operator!=(uint256_t const &x) const
uint256_t operator>>(int x) const
uint256_t operator&(uint256_t const &x)
uint256_t & operator=(uint256_t const &x)
bool operator<=(uint256_t const &x) const
uint256_t & operator-=(uint256_t const &x)
bool operator>(uint256_t const &x) const
uint256_t operator<<(int x) const
bool operator<(uint256_t const &x) const
uint256_t & operator|=(uint256_t const &x)
bool operator>=(uint256_t const &x) const
bool operator==(uint256_t const &x) const
uint256_t & operator=(uint64_t const &x)
uint256_t operator|(uint256_t const &x)
uint16_t select(uint32_t i)
uint256_t operator-(uint256_t const &x)
friend std::ostream & operator<<(std::ostream &, uint256_t const &)
bool operator>(uint64_t const &x) const
uint256_t & operator=(uint256_t &&x)
uint256_t & operator+=(uint256_t const &x)
uint256_t operator+(uint256_t const &x)
uint256_t(uint256_t const &x)
Namespace for the succinct data structure library.
std::ostream & operator<<(std::ostream &os, bp_interval< t_int > const &interval)
static 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 constexpr uint32_t hi(uint64_t x)
Position of the most significant set bit the 64-bit word x.
static 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.