C51: FASTER INTEGER DIVISION
Information in this knowledgebase article applies to:
I have an algorithm that depends on the execution speed of integer division. I am using a device without an arithmetic unit. Therefore, I cannot use an algorithm that relies on an arithmetic unit.
The algorithm that I need to speed up has the following requirements:
I have investigated the algorithm provided in the C51 Compiler Run-Time Library. It appears to be quite clever. But, is there a way to speed it up even further?
Yes. When it is possible to constrain the values used in math operations (like division) so that they fall within a specific range, you can create an algorithm that is faster than the standard division algorithm. In addition, loops in the division algorithm can be unrolled to gain a little more speed (at the cost of wasting memory).
The attachment to this knowledgebase article presents two solutions to your problem:
Request the files attached to this knowledgebase article.
Last Reviewed: Wednesday, July 14, 2010
of your data.