From what I understand, the current method of doing integer division is calculating the inverse in hardware and then performing a multiplication.
I have some C# code where a ton of time is being spent in integer division, with values that are changed rarely enough that their values can be cached.
I want to perform the hardware algorithm in software, i.e. calculate the inverse of the divisors and turn all these divisions into multiplication. Does anyone know the algorithm to perform this transformation, or even better, is there something in the CLR that can perform this automatically?