Fast MUL in ASM?
Hi!
Is there a fast multiply in ASM, or do I have to write my own?
It is a 16bit by 8 bits multiply. Or, if you want, 32 bit by 8 bit without overflow.
Any code snipplets welcome!
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
Is there a fast multiply in ASM, or do I have to write my own?
It is a 16bit by 8 bits multiply. Or, if you want, 32 bit by 8 bit without overflow.
Any code snipplets welcome!
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO

Comments
' ' Multiply x[noparse][[/noparse]15..0] by y[noparse][[/noparse]15..0] (y[noparse][[/noparse]31..16] must be 0) ' on exit, product in y[noparse][[/noparse]31..0] ' multiply shl x,#16 'get multiplicand into x[noparse][[/noparse]31..16] mov t,#16 'ready for 16 multiplier bits shr y,#1 wc 'get initial multiplier bit into c :loop if_c add y,x wc 'if c set, add multiplicand into product rcr y,#1 wc 'get next multiplier bit into c, shift product djnz t,#:loop 'loop until done multiply_ret ret 'return with product in y[noparse][[/noparse]31..0]just unrool and enjoy
It is available in "Propeller Guts"
-Dan
Post Edited (Direct Digital Labs) : 12/14/2007 6:40:30 PM GMT