--- In lpc2000@yahoogroups.com, "James Dabbs" <jdabbs@t...> wrote: > > I'm trying to squeeze a few more cycles out of one my LPC, and I'm > looking for an optimized way to divide by 10 and leave the quotient and > remainder. I.e., a faster way to do this: > > #define DIVIDE_BY_10(D, Q, R) Q=D/10; R=D%10; // D is unsigned long Check out "How to optimize for the Pentium family of microprocessors" http://www.agner.org/assem/pentopt.pdf The section "Division (all processors)" has a smart algorithm for converting division by a constant to a cheaper multiplication and shift. Karl Olsen
Message
Re: Slightly OT -- Fast Divide By 10
2004-11-30 by Karl Olsen