[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] FT_MulDiv optimization
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] FT_MulDiv optimization |
Date: |
Sat, 16 Aug 2014 07:47:04 +0200 (CEST) |
> FT_MulFix optimized like this on line 543:
> if ( ua <= 2048 && ub <= 1048576L )
> ua = ( ua * ub + 0x8000UL ) >> 16;
>
> Of course, when we anchor 2048 and use unsigned multiplication, it
> should safely have been
> if ( ua <= 2048 && ub <= 2097135L )
>
> but that's not my point. I do not know why 2048 is chosen, but we
> can relax the condition similarly to the recent FT_MulDiv change. We
> can use this to cover the old range *completely* and grab some more:
>
> if ( ua + ( ub >> 8 ) <= 8191UL )
>
> So, what was so special about 2048?
I can't remember, sorry. The git archive doesn't show a result
either, so I guess it was an ad-hoc assumption. If you can provide a
better version: This is OK with me :-) To verify the function, it
might be prudent to write a small test program, comparing the old and
the new results...
Werner