View Single Post
Old 20 March 2019, 10:07   #16
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quote:
Originally Posted by alpine9000 View Post
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.
ross is offline  
 
Page generated in 0.04684 seconds with 11 queries