Re: [stella] Divide by 3

Subject: Re: [stella] Divide by 3
From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx>
Date: Sat, 18 Dec 2004 18:06:29 -0800 (PST)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 18 Dec 2004, Adam Thornton wrote:
> > Is there an easy way to do it without a loop or table?
> >
> In general?  I doubt it.  What sort of value are you working with?  
> 8-bit register content?  16-bit word?  I'll bet that for 8 and 16 bits 
> we can come up with something both small and fast.

For an 8 bit value?

log base 2 of (256/3) = 6.4

A binary search could find it quickly...

- -- 
adam@xxxxxxxxxxxxxxxx        http://cuddlepuddle.org/~adam
KG6GZR                       http://cuddlepuddle.org/~adam/resume.html

"Feminist?  Why would I want to alienate half the population?  I'm an egalitarian."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD4DBQFBxOIkyvXf5Z0z5zERAhrbAJUXPGmQEb0SH9cEi36yujZvaym3AJ0SLiKJ
2QZJZPSe937P/5sKSh03uA==
=yvHe
-----END PGP SIGNATURE-----


Current Thread