Quote:
Originally Posted by alpine9000
I'm not great at cycle counting, but your solution and the gcc one are a pretty similar number of cycles (due to the large number of bits you shift) ? Except your solution is much more compact!
|
On 000 is practically same cycles.
But on 020+ (mcgeezer environment), thanks to barrel shifter, mine is faster.
And there another advantage: on upper register part you have directly the integer result.
On the lower the 1/2^16 fractional part, that you can scale with a shift or table to make it decimal
(the lsr stuff this in byte position and expels rounding errors, just to make it consistent with the original code).
GCC solution is for a simple, integer only, result.