yeah, sadly this isn't a constant.
There are a few places i need a fast divide, but one is correcting an ADC value for a sensor which isn't always full adc scale (0-5V).
It has to be field adjustable so, for example, if the sensor min is 0.6V and max 4.5V this can be corrected for in code to produce a 0-255 value corresponding to min-max, eg
if (adc_data>minval)
{
if (adc_data<maxval)
{
div_struct = ldiv( ( (uint16_t)(adc_data) - minval) * 255 ) , (maxval - minval));
sensordata = div_struct.quot;
}
else
{
sensordata = 255;
}
}
else
{
sensordata = 0;
}