Date : Wed, 15 Jun 2005 22:54:56 +0200
From : Carlo <radiorama@...>
Subject: Re: Faster 6502 multiplication
Richard_Talbot-Watkins@... wrote:
> Your first method would be more efficient than the second if the CPU was
> having to divide the term(s) by 4 itself.
>
> But what I am trying to do is get rid of the division by 4 altogether by
> looking up "pre-divided-by-4" values from the table. Remember, that
> (a+b)^2 - (a-b)^2 is an 18-bit result, and so would require more byte
> lookups and/or some additional bit-shifting to get the result. I am trying
> to create code which is lean on CPU cycles here!
Sorry for reading your message superficially. I didn't enter deeply into the
description of the algorithm...
> *bangs forehead against desk*
>
> D'oh, I should've considered that more closely before my last reply.
>
> Of course, since it's a multiple of 4, the bottom two bits will always be
> zero. Which means the bottom two bits of (a+b)^2 and (a-b)^2 have to be
> equal. So we can discard them straight away as we are not expecting
> anything other than a result of 00 from them.
That's exactly what I meant to say of course :)
Ciao,
Carlo.