Displaying 1 result from an estimated 1 matches for "mmi_of".
2019 Feb 20
2
proposal for optimization method
...er the following steps:
from the 2 constants (d and r) we create 3 constants (with the same bit length):
constants uint32 s,u,mmi;
mmi = find_mod_mul_inverse(d,32);
s = (r*mmi);
u = (UINT32_MAX-r)/d; // UINT32_MAX corresponds to pow(2,32)-1.
the idea behind these constants is the following formula:
mmi_of(d)*x=x/d+(x%d)*mmi_of(d)
now after we generated the constants, we will just emit the following
code instead of the former:
bool check_remainder(uint32 x)
{
return ((x*mmi)-s)<=u;
}
Anyway, I looked at the file IntegerDivision.cpp, it seems to me that
this new optimization is more effective the...