> No offense, but I counted 7 cycles per iteration in a loop that gets > executed 8 times (actually, only 6 cycles for the last iteration). > Consequently, as written, the code was slower than 44 cycles. > > On the other hand, if you unroll that loop the code will run a lot more > quickly. One thing I personally like to do in my multiply routines, btw, > is to write them so that the value sitting in the MSB isn't cleared before > the operation, but is instead added to the LSB of the result. This makes > computation of longer products convenient. Thanks Andy for providing the routine. But, yes the routine does take more instructions than 44 instructions. The routine with 44 instructions does exactly what John suggested. It unfolds the loops, that's all. Microchip have also provided a routine with loops (having code efficiency rather than time). I think Andy's code is pretty much similar to that. I am implementing a filter. So what I will do is try to adjust the coefficents to be as close to 2's power as possible. Then multiplications can be implemented as shifts. I have two multiplications in the filter. So even non-looped code will take 88 instructions (at worst)!!! Amey