It is only an approximation.
Say you have a bunch of numbers that you want divide.
multiplier = (1 << shift) / divisor.
for each number in bunchONumbers
result = (number * multiplier) >> shift.
the key is finding a highest shift you can use without overflow.




Reply With Quote