freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][master] src/psaux/psintrp.c (cf2_escSQRT): Impr


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] src/psaux/psintrp.c (cf2_escSQRT): Improve initial guess.
Date: Mon, 11 Sep 2023 16:34:43 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 30b0ce73
    by Alexei Podtelezhnikov at 2023-09-11T16:34:36+00:00
    src/psaux/psintrp.c (cf2_escSQRT): Improve initial guess.
    
    The worst number of iterations decreased from 11 to 5.  

1 changed file:

Changes:

  • src/psaux/psintrp.c
    ... ... @@ -37,6 +37,7 @@
    37 37
     
    
    38 38
     
    
    39 39
     #include "psft.h"
    
    40
    +#include <freetype/internal/ftcalc.h>
    
    40 41
     #include <freetype/internal/ftdebug.h>
    
    41 42
     #include <freetype/internal/services/svcfftl.h>
    
    42 43
     
    
    ... ... @@ -2276,9 +2277,8 @@
    2276 2277
                         arg = cf2_stack_popFixed( opStack );
    
    2277 2278
                         if ( arg > 0 )
    
    2278 2279
                         {
    
    2279
    -                      /* use a start value that doesn't make */
    
    2280
    -                      /* the algorithm's addition overflow   */
    
    2281
    -                      FT_Fixed  root = arg < 10 ? arg : arg >> 1;
    
    2280
    +                      /* initial guess based on the most significant bit */
    
    2281
    +                      FT_Fixed  root = 1 << ( ( 17 + FT_MSB( arg ) ) >> 1 );
    
    2282 2282
                           FT_Fixed  new_root;
    
    2283 2283
     
    
    2284 2284
     
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]