> Clay, how is this different than just adding them and shifting right once
> (in either order)? Isn't this just dividing their sum by 2? Or is there
> some value in losing the MSB?
>
Oh, I should have been more descriptive-- teach me to fire off e-mail when
trying to leave for the night.
You use an 8-bit register, but preserve the carry bit. The shifts are
really just eliminating the lowest bit which doesn't matter for the
resolution we're needing. Shifting left first gives you a chance to check
the carry bit and see if the number is "large" or not (since it's a
distance) so you can handle a large distance a little differently if you
want. (Since it's really just an average of the two distances you might
want to start with one shift and if it's a "big" number adjust the scaling
if the second number is small and vice-versa.) Since it's an average it's a
little better than just taking one distance or the other-- main thing is
that 's fast particularly when you don't have a divider or multiplier for
other than powers of two...
-Clay
Received on Thu Oct 28 10:55:07 1999
This archive was generated by hypermail 2.1.8 : Fri Aug 01 2003 - 00:32:47 EDT