Module reth::core::primitives::alloy_primitives::ruint::algorithms::div

Expand description

⚠️ Collection of division algorithms.

Warning. Most functions in this module are currently not considered part of the stable API and may be changed or removed in future minor releases.

All division algorithms also compute the remainder. There is no benefit to splitting the division and remainder into separate functions, since the remainder is always computed as part of the division algorithm.

These functions are adapted from algorithms in MG10 and K97.

Functions§

  • ⚠️ Division with remainder.
  • ⚠️ Computes the quotient and remainder of a u128 divided by a u64.
  • ⚠️ Computes the quotient and remainder of a u128 divided by a u64.
  • ⚠️ Computes the quotient of a 192 bits divided by a normalized u128.
  • ⚠️ Computes the quotient of a 192 bits divided by a normalized u128.
  • TODO: This implementation is off by one.
  • ⚠️ Compute single limb division.
  • ⚠️ Compute double limb division.
  • ⚠️ Compute single limb normalized division.
  • ⚠️ Compute double limb normalized division.
  • ⚠️ In-place Knuth long division with implicit normalization and reciprocals.
  • ⚠️ In-place Knuth normalized long division with reciprocals.
  • ⚠️ Computes $\floor{\frac{2^{128} - 1}{\mathsf{d}}} - 2^{64}$.
  • ⚠️ Computes $\floor{\frac{2^{192} - 1}{\mathsf{d}}} - 2^{64}$.
  • ⚠️ Computes $\floor{\frac{2^{192} - 1}{\mathsf{d}}} - 2^{64}$.
  • ⚠️ Computes $\floor{\frac{2^{128} - 1}{\mathsf{d}}} - 2^{64}$.
  • ⚠️ Computes $\floor{\frac{2^{128} - 1}{\mathtt{d}}} - 2^{64}$.