Re: LZ: manipulations


[Prev][Next][Index][Thread]

Re: LZ: manipulations



OoooEJoooo@aol.com wrote:
> 
> Which type of these manipulations is most efficient???
> 
> Is  ld a,5
>      ld b,a
>      ld a,50
>      sub b
> 
> More efficient than
> 
>      ld a,5
>      sub 50
>      neg


Well, the last one uses fewer cycles = faster.


> 
> And is a loop to add the number being multiplied to itself that # of times
> (i.e.  6 * 8 = 8+8+8+8+8+8)
> more efficient than a loop to shift left (6 * 8 = 6 shifted left three times)


Shift left is much much faster.


> 
> 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.


> 
> Finally, could someone explain division and how you would deal with
> remainders.


Not I, but there are routines at the zshell archive at ticalc.org


> 
> Thanx,
> 
> EJ
> <oo0ej0oo@alpha2.csd.uwm.edu>


<pre>
-- 
Real name: Jimmy Mårdell
Email....: mailto:mja@algonet.se
IRC-name.: Yarin
WWW......: http://www.algonet.se/~mja
</pre>


References: