Hi All

The Freescale Integer Math app note (AN1219) does not use the DIV instruction for extending division to 32 bit dividend/16 bit divisor, the author resorts to shift and subtract. I have not been able to find an algorithm that takes a advantage of a hardware divide instruction.

Does anyone have working code that uses DIV, or is it inherently inefficient and thus pointless?

TIA

Tom

The Freescale Integer Math app note (AN1219) does not use the DIV instruction for extending division to 32 bit dividend/16 bit divisor, the author resorts to shift and subtract. I have not been able to find an algorithm that takes a advantage of a hardware divide instruction.

Does anyone have working code that uses DIV, or is it inherently inefficient and thus pointless?

TIA

Tom

I don't think it is that extending the DIV instruction to 32 bits is inefficient. I think it is simply not possible.

Unlike multiplying, dividing is non-deterministic. So it can't be broken up into pieces like a multiply can. Hence, the shift/subtract algorithm that operates on the full 32 bits.