Skip to content

intx

Namespaces

Name
intx::internal
intx::le
intx::be

Classes

Name
struct intx::uint
struct intx::uint< 128 >
struct intx::result_with_carry
Contains result of add/sub/etc with a carry flag.
struct intx::div_result

Types

Name
using uint< 128 > uint128
using uint< 192 > uint192
using uint< 256 > uint256
using uint< 320 > uint320
using uint< 384 > uint384
using uint< 512 > uint512

Functions

Name
result_with_carry< uint64_t > add_with_carry(uint64_t x, uint64_t y, bool carry =false)
template <unsigned N>
result_with_carry< uint< N > >
add_with_carry(const uint< N > & x, const uint< N > & y, bool carry =false)
uint128 operator+(uint128 x, uint128 y)
uint128 operator+(uint128 x)
result_with_carry< uint64_t > sub_with_carry(uint64_t x, uint64_t y, bool carry =false)
template <unsigned N>
result_with_carry< uint< N > >
sub_with_carry(const uint< N > & x, const uint< N > & y, bool carry =false)
uint128 operator-(uint128 x, uint128 y)
uint128 operator-(uint128 x)
uint128 & operator++(uint128 & x)
uint128 & operator--(uint128 & x)
uint128 operator++(uint128 & x, int )
uint128 operator--(uint128 & x, int )
uint128 fast_add(uint128 x, uint128 y)
bool operator==(uint128 x, uint128 y)
bool operator!=(uint128 x, uint128 y)
bool operator<(uint128 x, uint128 y)
bool operator<=(uint128 x, uint128 y)
bool operator>(uint128 x, uint128 y)
bool operator>=(uint128 x, uint128 y)
uint128 operator~(uint128 x)
uint128 **[operator
uint128 operator&(uint128 x, uint128 y)
uint128 operator^(uint128 x, uint128 y)
uint128 operator<<(uint128 x, uint64_t shift)
uint128 operator<<(uint128 x, uint128 shift)
uint128 operator>>(uint128 x, uint64_t shift)
uint128 operator>>(uint128 x, uint128 shift)
uint128 umul(uint64_t x, uint64_t y)
Full unsigned multiplication 64 x 64 -> 128.
uint128 operator*(uint128 x, uint128 y)
uint128 & operator+=(uint128 & x, uint128 y)
uint128 & operator-=(uint128 & x, uint128 y)
uint128 & operator*=(uint128 & x, uint128 y)
uint128 & **[operator
uint128 & operator&=(uint128 & x, uint128 y)
uint128 & operator^=(uint128 & x, uint128 y)
uint128 & operator<<=(uint128 & x, uint64_t shift)
uint128 & operator>>=(uint128 & x, uint64_t shift)
uint64_t reciprocal_2by1(uint64_t d)
uint64_t reciprocal_3by2(uint128 d)
div_result< uint64_t > udivrem_2by1(uint128 u, uint64_t d, uint64_t v)
div_result< uint64_t, uint128 > udivrem_3by2(uint64_t u2, uint64_t u1, uint64_t u0, uint128 d, uint64_t v)
div_result< uint128 > udivrem(uint128 x, uint128 y)
div_result< uint128 > sdivrem(uint128 x, uint128 y)
uint128 operator/(uint128 x, uint128 y)
uint128 operator%(uint128 x, uint128 y)
uint128 & operator/=(uint128 & x, uint128 y)
uint128 & operator%=(uint128 & x, uint128 y)
bool is_constant_evaluated()
unsigned clz_generic(uint32_t x)
unsigned clz_generic(uint64_t x)
unsigned clz(uint32_t x)
unsigned clz(uint64_t x)
unsigned clz(uint128 x)
template <typename T >
T
bswap(T x) =delete
uint8_t bswap(uint8_t x)
uint16_t bswap(uint16_t x)
uint32_t bswap(uint32_t x)
uint64_t bswap(uint64_t x)
uint128 bswap(uint128 x)
template <typename T >
void
throw_(const char * what)
int from_dec_digit(char c)
int from_hex_digit(char c)
template <typename Int >
Int
from_string(const char * str)
template <typename Int >
Int
from_string(const std::string & s)
uint128 operator""_u128(const char * s)
template <unsigned N>
std::string
to_string(uint< N > x, int base =10)
template <unsigned N>
std::string
hex(uint< N > x)
template <unsigned N>
bool
operator==(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator==(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator==(const T & x, const uint< N > & y)
template <unsigned N>
bool
operator!=(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator!=(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator!=(const T & x, const uint< N > & y)
bool operator<(const uint256 & x, const uint256 & y)
template <unsigned N>
bool
operator<(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator<(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator<(const T & x, const uint< N > & y)
template <unsigned N>
bool
operator>(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator>(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator>(const T & x, const uint< N > & y)
template <unsigned N>
bool
operator>=(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator>=(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator>=(const T & x, const uint< N > & y)
template <unsigned N>
bool
operator<=(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator<=(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
bool
operator<=(const T & x, const uint< N > & y)
template <unsigned N>
bool
slt(const uint< N > & x, const uint< N > & y)
template <unsigned N>
uint< N >
**[operator
template <unsigned N>
uint< N >
operator&(const uint< N > & x, const uint< N > & y)
template <unsigned N>
uint< N >
operator^(const uint< N > & x, const uint< N > & y)
template <unsigned N>
uint< N >
operator~(const uint< N > & x)
uint256 operator<<(const uint256 & x, uint64_t shift)
template <unsigned N>
uint< N >
operator<<(const uint< N > & x, uint64_t shift)
uint256 operator>>(const uint256 & x, uint64_t shift)
template <unsigned N>
uint< N >
operator>>(const uint< N > & x, uint64_t shift)
template <unsigned N>
uint< N >
operator<<(const uint< N > & x, const uint< N > & shift)
template <unsigned N>
uint< N >
operator>>(const uint< N > & x, const uint< N > & shift)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator<<(const uint< N > & x, const T & shift)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator>>(const uint< N > & x, const T & shift)
template <unsigned N>
uint< N > &
operator>>=(uint< N > & x, uint64_t shift)
uint64_t * as_words(uint128 & x)
const uint64_t * as_words(const uint128 & x)
template <unsigned N>
uint64_t *
as_words(uint< N > & x)
template <unsigned N>
const uint64_t *
as_words(const uint< N > & x)
template <unsigned N>
uint8_t *
as_bytes(uint< N > & x)
template <unsigned N>
const uint8_t *
as_bytes(const uint< N > & x)
template <unsigned N>
uint< N >
operator+(const uint< N > & x, const uint< N > & y)
template <unsigned N>
uint< N >
operator-(const uint< N > & x)
template <unsigned N>
uint< N >
operator-(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator+=(uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator-=(uint< N > & x, const T & y)
template <unsigned N>
uint< 2 *N >
umul(const uint< N > & x, const uint< N > & y)
template <unsigned N>
uint< N >
operator*(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator*=(uint< N > & x, const T & y)
template <unsigned N>
uint< N >
exp(uint< N > base, uint< N > exponent)
template <unsigned N>
unsigned
count_significant_words(const uint< N > & x)
unsigned count_significant_bytes(uint64_t x)
template <unsigned N>
unsigned
count_significant_bytes(const uint< N > & x)
template <unsigned N>
unsigned
clz(const uint< N > & x)
template <unsigned M,unsigned N>
div_result< uint< M >, uint< N > >
udivrem(const uint< M > & u, const uint< N > & v)
template <unsigned N>
div_result< uint< N > >
sdivrem(const uint< N > & u, const uint< N > & v)
template <unsigned N>
uint< N >
operator/(const uint< N > & x, const uint< N > & y)
template <unsigned N>
uint< N >
operator%(const uint< N > & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator/=(uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator%=(uint< N > & x, const T & y)
template <unsigned N>
uint< N >
bswap(const uint< N > & x)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator+(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator+(const T & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator-(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator-(const T & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator*(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator*(const T & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator/(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator/(const T & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator%(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator%(const T & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
**[operator
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
**[operator
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator&(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator&(const T & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator^(const uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N >
operator^(const T & x, const uint< N > & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
**[operator
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator&=(uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator^=(uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator<<=(uint< N > & x, const T & y)
template <unsigned N,typename T ,typename =typename std::enable_if>::value>::type>
uint< N > &
operator>>=(uint< N > & x, const T & y)
uint256 addmod(const uint256 & x, const uint256 & y, const uint256 & mod)
uint256 mulmod(const uint256 & x, const uint256 & y, const uint256 & mod)
uint256 operator""_u256(const char * s)
uint512 operator""_u512(const char * s)

Types Documentation

using uint128

using intx::uint128 = uint<128>;

using uint192

using intx::uint192 = uint<192>;

using uint256

using intx::uint256 = uint<256>;

using uint320

using intx::uint320 = uint<320>;

using uint384

using intx::uint384 = uint<384>;

using uint512

using intx::uint512 = uint<512>;

Functions Documentation

function add_with_carry

inline result_with_carry< uint64_t > add_with_carry(
    uint64_t x,
    uint64_t y,
    bool carry =false
)

Linear arithmetic operators.

function add_with_carry

template <unsigned N>
inline result_with_carry< uint< N > > add_with_carry(
    const uint< N > & x,
    const uint< N > & y,
    bool carry =false
)

function operator+

inline uint128 operator+(
    uint128 x,
    uint128 y
)

function operator+

inline uint128 operator+(
    uint128 x
)

function sub_with_carry

inline result_with_carry< uint64_t > sub_with_carry(
    uint64_t x,
    uint64_t y,
    bool carry =false
)

function sub_with_carry

template <unsigned N>
inline result_with_carry< uint< N > > sub_with_carry(
    const uint< N > & x,
    const uint< N > & y,
    bool carry =false
)

Performs subtraction of two unsigned numbers and returns the difference and the carry bit (aka borrow, overflow).

function operator-

inline uint128 operator-(
    uint128 x,
    uint128 y
)

function operator-

inline uint128 operator-(
    uint128 x
)

function operator++

inline uint128 & operator++(
    uint128 & x
)

function operator--

inline uint128 & operator--(
    uint128 & x
)

function operator++

inline uint128 operator++(
    uint128 & x,
    int 
)

function operator--

inline uint128 operator--(
    uint128 & x,
    int 
)

function fast_add

inline uint128 fast_add(
    uint128 x,
    uint128 y
)

Optimized addition.

This keeps the multiprecision addition until CodeGen so the pattern is not broken during other optimizations.

function operator==

inline bool operator==(
    uint128 x,
    uint128 y
)

Comparison operators.

In all implementations bitwise operators are used instead of logical ones to avoid branching.

function operator!=

inline bool operator!=(
    uint128 x,
    uint128 y
)

function operator<

inline bool operator<(
    uint128 x,
    uint128 y
)

function operator<=

inline bool operator<=(
    uint128 x,
    uint128 y
)

function operator>

inline bool operator>(
    uint128 x,
    uint128 y
)

function operator>=

inline bool operator>=(
    uint128 x,
    uint128 y
)

function operator~

inline uint128 operator~(
    uint128 x
)

Bitwise operators.

function operator|

inline uint128 operator|(
    uint128 x,
    uint128 y
)

function operator&

inline uint128 operator&(
    uint128 x,
    uint128 y
)

function operator^

inline uint128 operator^(
    uint128 x,
    uint128 y
)

function operator<<

inline uint128 operator<<(
    uint128 x,
    uint64_t shift
)

function operator<<

inline uint128 operator<<(
    uint128 x,
    uint128 shift
)

function operator>>

inline uint128 operator>>(
    uint128 x,
    uint64_t shift
)

function operator>>

inline uint128 operator>>(
    uint128 x,
    uint128 shift
)

function umul

inline uint128 umul(
    uint64_t x,
    uint64_t y
)

Full unsigned multiplication 64 x 64 -> 128.

Multiplication

function operator*

inline uint128 operator*(
    uint128 x,
    uint128 y
)

function operator+=

inline uint128 & operator+=(
    uint128 & x,
    uint128 y
)

Assignment operators.

function operator-=

inline uint128 & operator-=(
    uint128 & x,
    uint128 y
)

function operator*=

inline uint128 & operator*=(
    uint128 & x,
    uint128 y
)

function operator|=

inline uint128 & operator|=(
    uint128 & x,
    uint128 y
)

function operator&=

inline uint128 & operator&=(
    uint128 & x,
    uint128 y
)

function operator^=

inline uint128 & operator^=(
    uint128 & x,
    uint128 y
)

function operator<<=

inline uint128 & operator<<=(
    uint128 & x,
    uint64_t shift
)

function operator>>=

inline uint128 & operator>>=(
    uint128 & x,
    uint64_t shift
)

function reciprocal_2by1

inline uint64_t reciprocal_2by1(
    uint64_t d
)

Computes the reciprocal (2^128 - 1) / d - 2^64 for normalized d.

Based on Algorithm 2 from "Improved division by invariant integers".

function reciprocal_3by2

inline uint64_t reciprocal_3by2(
    uint128 d
)

function udivrem_2by1

inline div_result< uint64_t > udivrem_2by1(
    uint128 u,
    uint64_t d,
    uint64_t v
)

function udivrem_3by2

inline div_result< uint64_t, uint128 > udivrem_3by2(
    uint64_t u2,
    uint64_t u1,
    uint64_t u0,
    uint128 d,
    uint64_t v
)

function udivrem

inline div_result< uint128 > udivrem(
    uint128 x,
    uint128 y
)

function sdivrem

inline div_result< uint128 > sdivrem(
    uint128 x,
    uint128 y
)

function operator/

inline uint128 operator/(
    uint128 x,
    uint128 y
)

function operator%

inline uint128 operator%(
    uint128 x,
    uint128 y
)

function operator/=

inline uint128 & operator/=(
    uint128 & x,
    uint128 y
)

function operator%=

inline uint128 & operator%=(
    uint128 & x,
    uint128 y
)

function is_constant_evaluated

inline bool is_constant_evaluated()

function clz_generic

inline unsigned clz_generic(
    uint32_t x
)

function clz_generic

inline unsigned clz_generic(
    uint64_t x
)

function clz

inline unsigned clz(
    uint32_t x
)

function clz

inline unsigned clz(
    uint64_t x
)

function clz

inline unsigned clz(
    uint128 x
)

function bswap

template <typename T >
T bswap(
    T x
) =delete

function bswap

inline uint8_t bswap(
    uint8_t x
)

function bswap

inline uint16_t bswap(
    uint16_t x
)

function bswap

inline uint32_t bswap(
    uint32_t x
)

function bswap

inline uint64_t bswap(
    uint64_t x
)

function bswap

inline uint128 bswap(
    uint128 x
)

function throw_

template <typename T >
inline void throw_(
    const char * what
)

function from_dec_digit

inline int from_dec_digit(
    char c
)

function from_hex_digit

inline int from_hex_digit(
    char c
)

function from_string

template <typename Int >
inline Int from_string(
    const char * str
)

function from_string

template <typename Int >
inline Int from_string(
    const std::string & s
)

function operator""_u128

inline uint128 operator""_u128(
    const char * s
)

function to_string

template <unsigned N>
inline std::string to_string(
    uint< N > x,
    int base =10
)

function hex

template <unsigned N>
inline std::string hex(
    uint< N > x
)

function operator==

template <unsigned N>
inline bool operator==(
    const uint< N > & x,
    const uint< N > & y
)

function operator==

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator==(
    const uint< N > & x,
    const T & y
)

function operator==

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator==(
    const T & x,
    const uint< N > & y
)

function operator!=

template <unsigned N>
inline bool operator!=(
    const uint< N > & x,
    const uint< N > & y
)

function operator!=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator!=(
    const uint< N > & x,
    const T & y
)

function operator!=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator!=(
    const T & x,
    const uint< N > & y
)

function operator<

inline bool operator<(
    const uint256 & x,
    const uint256 & y
)

function operator<

template <unsigned N>
inline bool operator<(
    const uint< N > & x,
    const uint< N > & y
)

function operator<

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator<(
    const uint< N > & x,
    const T & y
)

function operator<

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator<(
    const T & x,
    const uint< N > & y
)

function operator>

template <unsigned N>
inline bool operator>(
    const uint< N > & x,
    const uint< N > & y
)

function operator>

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator>(
    const uint< N > & x,
    const T & y
)

function operator>

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator>(
    const T & x,
    const uint< N > & y
)

function operator>=

template <unsigned N>
inline bool operator>=(
    const uint< N > & x,
    const uint< N > & y
)

function operator>=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator>=(
    const uint< N > & x,
    const T & y
)

function operator>=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator>=(
    const T & x,
    const uint< N > & y
)

function operator<=

template <unsigned N>
inline bool operator<=(
    const uint< N > & x,
    const uint< N > & y
)

function operator<=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator<=(
    const uint< N > & x,
    const T & y
)

function operator<=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline bool operator<=(
    const T & x,
    const uint< N > & y
)

function slt

template <unsigned N>
inline bool slt(
    const uint< N > & x,
    const uint< N > & y
)

Signed less than comparison.

Interprets the arguments as two's complement signed integers and checks the "less than" relation.

function operator|

template <unsigned N>
inline uint< N > operator|(
    const uint< N > & x,
    const uint< N > & y
)

function operator&

template <unsigned N>
inline uint< N > operator&(
    const uint< N > & x,
    const uint< N > & y
)

function operator^

template <unsigned N>
inline uint< N > operator^(
    const uint< N > & x,
    const uint< N > & y
)

function operator~

template <unsigned N>
inline uint< N > operator~(
    const uint< N > & x
)

function operator<<

inline uint256 operator<<(
    const uint256 & x,
    uint64_t shift
)

function operator<<

template <unsigned N>
inline uint< N > operator<<(
    const uint< N > & x,
    uint64_t shift
)

function operator>>

inline uint256 operator>>(
    const uint256 & x,
    uint64_t shift
)

function operator>>

template <unsigned N>
inline uint< N > operator>>(
    const uint< N > & x,
    uint64_t shift
)

function operator<<

template <unsigned N>
inline uint< N > operator<<(
    const uint< N > & x,
    const uint< N > & shift
)

function operator>>

template <unsigned N>
inline uint< N > operator>>(
    const uint< N > & x,
    const uint< N > & shift
)

function operator<<

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator<<(
    const uint< N > & x,
    const T & shift
)

function operator>>

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator>>(
    const uint< N > & x,
    const T & shift
)

function operator>>=

template <unsigned N>
inline uint< N > & operator>>=(
    uint< N > & x,
    uint64_t shift
)

function as_words

inline uint64_t * as_words(
    uint128 & x
)

function as_words

inline const uint64_t * as_words(
    const uint128 & x
)

function as_words

template <unsigned N>
inline uint64_t * as_words(
    uint< N > & x
)

function as_words

template <unsigned N>
inline const uint64_t * as_words(
    const uint< N > & x
)

function as_bytes

template <unsigned N>
inline uint8_t * as_bytes(
    uint< N > & x
)

function as_bytes

template <unsigned N>
inline const uint8_t * as_bytes(
    const uint< N > & x
)

function operator+

template <unsigned N>
inline uint< N > operator+(
    const uint< N > & x,
    const uint< N > & y
)

function operator-

template <unsigned N>
inline uint< N > operator-(
    const uint< N > & x
)

function operator-

template <unsigned N>
inline uint< N > operator-(
    const uint< N > & x,
    const uint< N > & y
)

function operator+=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator+=(
    uint< N > & x,
    const T & y
)

function operator-=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator-=(
    uint< N > & x,
    const T & y
)

function umul

template <unsigned N>
inline uint< 2 *N > umul(
    const uint< N > & x,
    const uint< N > & y
)

function operator*

template <unsigned N>
inline uint< N > operator*(
    const uint< N > & x,
    const uint< N > & y
)

Multiplication implementation using word access and discarding the high part of the result product.

function operator*=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator*=(
    uint< N > & x,
    const T & y
)

function exp

template <unsigned N>
inline uint< N > exp(
    uint< N > base,
    uint< N > exponent
)

function count_significant_words

template <unsigned N>
inline unsigned count_significant_words(
    const uint< N > & x
)

function count_significant_bytes

inline unsigned count_significant_bytes(
    uint64_t x
)

function count_significant_bytes

template <unsigned N>
inline unsigned count_significant_bytes(
    const uint< N > & x
)

function clz

template <unsigned N>
inline unsigned clz(
    const uint< N > & x
)

function udivrem

template <unsigned M,
unsigned N>
div_result< uint< M >, uint< N > > udivrem(
    const uint< M > & u,
    const uint< N > & v
)

function sdivrem

template <unsigned N>
inline div_result< uint< N > > sdivrem(
    const uint< N > & u,
    const uint< N > & v
)

function operator/

template <unsigned N>
inline uint< N > operator/(
    const uint< N > & x,
    const uint< N > & y
)

function operator%

template <unsigned N>
inline uint< N > operator%(
    const uint< N > & x,
    const uint< N > & y
)

function operator/=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator/=(
    uint< N > & x,
    const T & y
)

function operator%=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator%=(
    uint< N > & x,
    const T & y
)

function bswap

template <unsigned N>
inline uint< N > bswap(
    const uint< N > & x
)

function operator+

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator+(
    const uint< N > & x,
    const T & y
)

function operator+

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator+(
    const T & x,
    const uint< N > & y
)

function operator-

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator-(
    const uint< N > & x,
    const T & y
)

function operator-

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator-(
    const T & x,
    const uint< N > & y
)

function operator*

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator*(
    const uint< N > & x,
    const T & y
)

function operator*

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator*(
    const T & x,
    const uint< N > & y
)

function operator/

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator/(
    const uint< N > & x,
    const T & y
)

function operator/

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator/(
    const T & x,
    const uint< N > & y
)

function operator%

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator%(
    const uint< N > & x,
    const T & y
)

function operator%

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator%(
    const T & x,
    const uint< N > & y
)

function operator|

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator|(
    const uint< N > & x,
    const T & y
)

function operator|

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator|(
    const T & x,
    const uint< N > & y
)

function operator&

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator&(
    const uint< N > & x,
    const T & y
)

function operator&

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator&(
    const T & x,
    const uint< N > & y
)

function operator^

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator^(
    const uint< N > & x,
    const T & y
)

function operator^

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > operator^(
    const T & x,
    const uint< N > & y
)

function operator|=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator|=(
    uint< N > & x,
    const T & y
)

function operator&=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator&=(
    uint< N > & x,
    const T & y
)

function operator^=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator^=(
    uint< N > & x,
    const T & y
)

function operator<<=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator<<=(
    uint< N > & x,
    const T & y
)

function operator>>=

template <unsigned N,
typename T ,
typename  =typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type>
inline uint< N > & operator>>=(
    uint< N > & x,
    const T & y
)

function addmod

inline uint256 addmod(
    const uint256 & x,
    const uint256 & y,
    const uint256 & mod
)

function mulmod

inline uint256 mulmod(
    const uint256 & x,
    const uint256 & y,
    const uint256 & mod
)

function operator""_u256

inline uint256 operator""_u256(
    const char * s
)

function operator""_u512

inline uint512 operator""_u512(
    const char * s
)

Updated on 2026-04-13 at 23:22:46 -0700