Skip to content

intx::internal

Classes

Name
struct intx::internal::normalized_div_args

Functions

Name
uint16_t reciprocal_table_item(uint8_t d9)
unsigned clz_nonzero(uint64_t x)
Counts the number of zero leading bits in nonzero argument x.
template <unsigned M,unsigned N>
normalized_div_args< M, N >
normalize(const uint< M > & numerator, const uint< N > & denominator)
uint64_t udivrem_by1(uint64_t u[], int len, uint64_t d)
uint128 udivrem_by2(uint64_t u[], int len, uint128 d)
bool add(uint64_t s[], const uint64_t x[], const uint64_t y[], int len)
s = x + y.
uint64_t submul(uint64_t r[], const uint64_t x[], const uint64_t y[], int len, uint64_t multiplier)
r = x - multiplier * y.
void udivrem_knuth(uint64_t q[], uint64_t u[], int ulen, const uint64_t d[], int dlen)

Attributes

Name
uint16_t[] reciprocal_table
Reciprocal lookup table.

Functions Documentation

function reciprocal_table_item

inline uint16_t reciprocal_table_item(
    uint8_t d9
)

function clz_nonzero

inline unsigned clz_nonzero(
    uint64_t x
)

Counts the number of zero leading bits in nonzero argument x.

function normalize

template <unsigned M,
unsigned N>
inline normalized_div_args< M, N > normalize(
    const uint< M > & numerator,
    const uint< N > & denominator
)

function udivrem_by1

inline uint64_t udivrem_by1(
    uint64_t u[],
    int len,
    uint64_t d
)

Parameters:

  • u The array of a normalized numerator words. It will contain the quotient after execution.
  • len The number of numerator words.
  • d The normalized divisor.

Return: The remainder.

Divides arbitrary long unsigned integer by 64-bit unsigned integer (1 word).

function udivrem_by2

inline uint128 udivrem_by2(
    uint64_t u[],
    int len,
    uint128 d
)

Parameters:

  • u The array of a normalized numerator words. It will contain the quotient after execution.
  • len The number of numerator words.
  • d The normalized divisor.

Return: The remainder.

Divides arbitrary long unsigned integer by 128-bit unsigned integer (2 words).

function add

inline bool add(
    uint64_t s[],
    const uint64_t x[],
    const uint64_t y[],
    int len
)

s = x + y.

function submul

inline uint64_t submul(
    uint64_t r[],
    const uint64_t x[],
    const uint64_t y[],
    int len,
    uint64_t multiplier
)

r = x - multiplier * y.

function udivrem_knuth

inline void udivrem_knuth(
    uint64_t q[],
    uint64_t u[],
    int ulen,
    const uint64_t d[],
    int dlen
)

Attributes Documentation

variable reciprocal_table

uint16_t[] reciprocal_table = {REPEAT256()};

Reciprocal lookup table.


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