FLINT3.7.0-dev

NMOD_RED3_FOLD_FULLWORD, NMOD_RED3_FOLD_FULLWORD_NOSUB

Synopsis#include <flint/nmod.h>
NMOD_RED3_FOLD_FULLWORD(r, a_hi, a_me, a_lo, b1, b2, mod)source
NMOD_RED3_FOLD_FULLWORD_NOSUB(r, a_hi, a_me, a_lo, b1, b2, mod)source

Set r to (ahiB2+ameB+alo) mod n(a_{hi} B^2 + a_{me} B + a_{lo}) \bmod n for any words and mod.norm =0= 0, given b1=B mod nb_1 = B \bmod n and b2=B2 mod nb_2 = B^2 \bmod n (as computed by n_ll_barrett_precomp_preinv). They fold the input into the two words of ahib2+ameb1+aloa_{hi} b_2 + a_{me} b_1 + a_{lo}, then take one NMOD_RED2_FULLWORD step (Three words, full-word moduli). The first subtracts nn from the high word of the fold when needed; the second skips that subtraction and requires ahi≤Ya_{hi} \le Y for a bound YY such that _nmod_red3_fold_can_skip_sub(Y, b1, b2, mod) is nonzero. For n<2FLINT_BITS−1n < 2^{\mathtt{FLINT\_BITS} - 1}, use n_lll_mod_barrett.

Cite this page

The FLINT team, “NMOD_RED3_FOLD_FULLWORD, NMOD_RED3_FOLD_FULLWORD_NOSUB (nmod.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/nmod/NMOD_RED3_FOLD_FULLWORD.html (generated 2026-11-20).