FLINT3.7.0-dev

flint_mpn_divrem_1_preinv

Synopsis#include <flint/mpn_extras.h>
mp_limb_t flint_mpn_divrem_1_preinv(mp_ptr qp, mp_srcptr up, mp_size_t n, mp_limb_t d, mp_limb_t dinv, unsigned int norm)source

Divides (up,n)(\mathit{up}, n) by the limb dd, writing the quotient to (qp,n)(\mathit{qp}, n) and returning the remainder. Requires n≥1n \ge 1, d≠0d \ne 0, norm the number of leading zero bits of dd and dinv = n_preinvert_limb(d). qp may alias up. This is equivalent to mpn_divrem_1(qp, 0, up, n, d) and faster for small nn; for large nn GMP's assembly is usually faster.

Cite this page

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