dmd.backend.divcoeff

Algorithms from "Division by Invariant Integers using Multiplication" by Torbjoern Granlund and Peter L. Montgomery

Compiler implementation of the D programming language.

Members

Functions

choose_multiplier
bool choose_multiplier(int N, ullong d, int prec, ullong* pm, int* pshpost)

Implement Algorithm 6.2: Selection of multiplier and shift count

udiv_coefficients
bool udiv_coefficients(int N, ullong d, int* pshpre, ullong* pm, int* pshpost)

Find coefficients for Algorithm 4.2: Optimized code generation of unsigned q=n/d for constant nonzero d Input: N 32 or 64 (width of divide) d divisor (not a power of 2) Output: *pshpre pre-shift *pm factor *pshpost post-shift

Meta