FLINT3.7.0-dev

radix_addlsh, radix_sublsh, radix_lshsub

Synopsis#include <flint/radix.h>
ulong radix_addlsh(nn_ptr res, nn_srcptr a, slong an, nn_srcptr b, slong bn, unsigned int sh, const radix_t radix)source
ulong radix_sublsh(nn_ptr res, nn_srcptr a, slong an, nn_srcptr b, slong bn, unsigned int sh, const radix_t radix)source
ulong radix_lshsub(nn_ptr res, nn_srcptr b, slong bn, unsigned int sh, nn_srcptr a, slong an, const radix_t radix)source

Fused addition and subtraction with a shift of b by 1 \le \mathit{sh} < e digits: set (\mathit{res}, L) with L = \max(\mathit{an}, \mathit{bn} + 1) to a + b \cdot b^{\mathit{sh}}, a - b \cdot b^{\mathit{sh}} and b \cdot b^{\mathit{sh}} - a, and return the carry (0 or 1), respectively the borrow, which is 0 since the result must be nonnegative. Requires \mathit{bn} \ge 1. res may alias a but not b. The shifted operand is never formed in memory.

Cite this page

The FLINT team, “radix_addlsh, radix_sublsh, radix_lshsub (radix.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/radix/radix_addlsh.html (generated 2026-10-20).