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)sourceulong radix_sublsh(nn_ptr res, nn_srcptr a, slong an, nn_srcptr b, slong bn, unsigned int sh, const radix_t radix)sourceulong radix_lshsub(nn_ptr res, nn_srcptr b, slong bn, unsigned int sh, nn_srcptr a, slong an, const radix_t radix)sourceFused 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).
@misc{flint-doc-radix-radix-addlsh,
author = {{The FLINT team}},
title = {{radix\_addlsh, radix\_sublsh, radix\_lshsub (radix.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/radix/radix_addlsh.html},
note = {Generated 2026-10-20}
}