Where can I find soft-multiply and divide algorithms?

前端 未结 7 1990
萌比男神i
萌比男神i 2021-02-19 09:00

I\'m working on a micro-controller without hardware multiply and divide. I need to cook up software algorithms for these basic operations that are a nice balance of compact siz

7条回答
  •  灰色年华
    2021-02-19 09:39

    To multiply, add partial products from the shifted multiplicand to an accumulator iff the corresponding bit in the multiplier is set. Shift multiplicand and multiplier at end of loop, testing multiplier & 1 to see if addition should be done.

提交回复
热议问题