Module algorithms Copy item path Source __add2 __sub2rev adc add2 /Two argument addition of raw slices:
a += b biguint_shl biguint_shr cmp_slice div_rem div_rem_digit div_wide Divide a two digit numerator by a one digit divisor, returns quotient and remainder: extended_gcd Uses the lehemer algorithm.
Based on https://github.com/golang/go/blob/master/src/math/big/int.go#L612
If extended
is set, the Bezout coefficients are calculated, otherwise they are None
. fls Find last set bit
fls(0) == 0, fls(u32::MAX) == 32 idiv_ceil Divide two integers, and ceil the result. ilog2 jacobi Jacobi returns the Jacobi symbol (x/y), either +1, -1, or 0.
The y argument must be an odd integer. mac3 Three argument multiply accumulate:
acc += b * c mac_digit Three argument multiply accumulate:
acc += b * c mac_with_carry mod_inverse Calculate the modular inverse of g
.
Implementation is based on the naive version from wikipedia. mul3 mul_with_carry sbb Subtract with borrow: scalar_mul sub2 sub2rev sub_sign xgcd XGCD sets z to the greatest common divisor of a and b and returns z.
If extended is true, XGCD returns their value such that z = ax + b y.