udiv_coefficients

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

extern (C) nothrow @safe
bool
udiv_coefficients
(
int N
,
ullong d
,
int* pshpre
,
ullong* pm
,
int* pshpost
)

Return Value

Type: bool

true Use algorithm: t1 = MULUH(m, n) q = SRL(t1 + SRL(n - t1, 1), shpost - 1)

false Use algorithm: q = SRL(MULUH(m, SRL(n, shpre)), shpost)

Meta