Finally came up with a fairly quick integer square root function. Basically, it uses the

Babylonian Method to calculate the square root of an integer representation of a decimal number that has about 3 decimal places, as shown.

d = i / 4096

so, for d = 1, i = 4096. for d = 1.5, i = 6144. And so on...

Anyway, the square root function finds the square root of a number, given the above rule for i. So, for the square root of i = 6144 (d = 1.5), sqrt(i) would return 5016 (5016 / 4096 = 1.225. It uses up about 28 microseconds to do this, too, and adds 108 bytes to the code to do so.

The reason I coded the square root this way was so I could then do this:

Code:

i = manifoldPressure + fuelPressure; // calculate pressure differential seen across injector
i <<= 12; // multiply by 4096
i /= fuelPressure; // divide by fuel system pressure to generate pressure ratio
injOpenPulseTime = injOpenPulseTime * iSqrt(i); // multiply fuel injector open time by integer square root of pressure ratio
injOpenPulseTime >>= 12; // shift right to complete factor adjustment

I estimate that this little bit of code would take about 36 microseconds to execute in total. This is well within the time span between injector firings.