Re: LZ: manipulations
[Prev][Next][Index][Thread]
Rob Taylor wrote:
>
> > > Also, would the shifting method be able to work for #'s that aren't powers of
> > > 2 (odd #'s)
> >
> > Nope. Only 2,4,8,16,32,64,128.
> >
> well one trick is to combine shifts and adds/subs
>
> e.g. to multiply by seve,
> store teh origional no ina nother register,
> shift teh oriogional register left 3 times
> subtract the copy you made
>
> hey presto, times by seven (simple algebra a*8-a =a*7)
>
> you can do this for pretty much any number..
Yes, but the number you want to multiply with must be
a constant. You can't for example multiply a*b. Then you
must use a multiply routine.
<pre>
--
Real name: Jimmy Mårdell
Email....: mailto:mja@algonet.se
IRC-name.: Yarin
WWW......: http://www.algonet.se/~mja
</pre>
References: