mpn_mod_set_mpn
Synopsis
#include <flint/mpn_mod.h>Sets res to x \bmod n, where x \ge 0 is given by the xn limbs at x (\mathit{xn} \ge 0; the top limb may be zero). This is the reduction used throughout the module for unreduced sums and products. res may be the same pointer as x but must not overlap it otherwise.
Values with fewer limbs than n, or with \ell limbs and less than n, are copied. Otherwise x is shifted left by \nu bits and divided by n 2^{\nu}, with GMP's mpn_divrem_2 for \ell = 2 and with flint_mpn_mod_preinvn and the precomputed inverse of the context for \ell \ge 3.
Cite this page
The FLINT team, “mpn_mod_set_mpn (mpn_mod.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mpn_mod/mpn_mod_set_mpn.html (generated 2026-10-20).
@misc{flint-doc-mpn-mod-mpn-mod-set-mpn,
author = {{The FLINT team}},
title = {{mpn\_mod\_set\_mpn (mpn\_mod.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/mpn_mod/mpn_mod_set_mpn.html},
note = {Generated 2026-10-20}
}