FLINT3.7.0-dev

n_div_precomp_init, n_div_precomp_init_preinv

Synopsis#include <flint/ulong_extras.h>
void n_div_precomp_init(n_div_precomp_t pre, ulong d)source
void n_div_precomp_init_preinv(n_div_precomp_t pre, ulong d, ulong dinv)source

Compute the data for division by d≥1d \ge 1. The second one takes dinv = n_preinvert_limb(d) and needs no division, since for dd not a power of two ⌊2ℓ+FLINT_BITS/d⌋\lfloor 2^{\ell + \mathtt{FLINT\_BITS}}/d \rfloor is the constant (dinv >> 1) | (UWORD(1) << (FLINT_BITS - 1)) of NMOD_RED (Barrett reduction with an nmod_t). The first one uses a two-word division where n_preinvert_limb does (FLINT_PREINVERT_LIMB_USE_NATIVE: a fast hardware divider), and otherwise calls the second one with n_preinvert_limb(d).

Cite this page

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