FLINT3.7.0-dev

radix_lshift_digits, radix_rshift_digits

Synopsis#include <flint/radix.h>
ulong radix_lshift_digits(nn_ptr res, nn_srcptr a, slong n, unsigned int e, const radix_t radix)source
ulong radix_rshift_digits(nn_ptr res, nn_srcptr a, slong n, unsigned int e, const radix_t radix)source

Shift (a,n)(a, n) by kk = e digits, for 1≤k1 \le k less than the limb exponent: the left shift sets (res,n)(\mathit{res}, n) to abk mod Bna b^k \bmod B^n and returns the kk digits shifted out (as the low digits of the returned limb); the right shift sets (res,n)(\mathit{res}, n) to ⌊a/bk⌋\lfloor a / b^k \rfloor and returns the kk digits shifted out as the high digits of the returned limb, that is, (a mod bk)be−k(a \bmod b^k) b^{e - k}. These are faster than radix_mul_1 and radix_divrem_1 with bkb^k. Shifts by whole limbs are pointer offsets.

Cite this page

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