Expand description
Recognition of the 512-bit product high word and of the full-precision mulDiv quotient.
Re-exportsยง
use super::*;๐
Constantsยง
- MIN_
NEWTON_ ๐STEPS - Newton steps that lift the
(3 * d) ^ 2seed, an inverse modulo2**4, to2**256.
Functionsยง
- bool_
word_ ๐condition - checked_
product_ ๐guard_ operands - Returns
(x, y)whenwordis the overflow checkx == 0 || (x * y) / x == y, which holds exactly whenmul_high(x, y) == 0. - exact_
product_ ๐parts - Returns
(a, b)whenlowisa * b - randhighismul_high(a, b) - lt(a * b, r)forr = mulmod(a, b, d). - exact_
shifted_ ๐product_ operands - Returns
(a, b, d)whenexpris the low word of(a * b - a * b % d) / twos: the exact low quotient(lo - rem) / twosjoined with(high - borrow) * (2**256 / twos). - full_
mul_ ๐div_ operands - Returns
(a, b, d)whenexpris the 512-by-256-bitmulDiv(a, b, d)quotient. - is_
increment_ ๐of - is_
inverse_ ๐shift - Returns whether
expris(0 - twos) / twos + 1, which is2**256 / twosmodulo2**256. - is_
less_ ๐than - is_
less_ ๐than_ word - is_
lowest_ ๐set_ bit - Returns whether
twosis(0 - d) & d, the lowest set bit ofd. - is_
mul_ ๐high_ factor - is_
mul_ ๐high_ of - is_
negation_ ๐of - is_
product_ ๐of - mul_
high_ ๐operands - Returns
(a, b)whenminuend - subtrahendis the high word ofa * b. - newton_
inverse_ ๐operand - Returns
dwhenexpris at leastMIN_NEWTON_STEPSofinv * (2 - d * inv)over the(3 * d) ^ 2seed, the inverse of an odddmodulo2**256. - normalize_
mul_ ๐high_ factor_ cmp - Decides comparisons between
mul_high(a, b)and one of its factors. - normalize_
quotient_ ๐offset_ eq - Rewrites
q + c == kand!q == kfor a word quotientqtoq == k', where a division reachesMAXonly asMAX / 1. - wide_
product_ ๐operands - word_
division_ ๐operands - Returns
(n, d)forn / d, also in theite(d == 0, 0, n / d)form of the EVMDIV.