freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 30b0ce730: src/psaux/psintrp.c (cf2_escSQRT): Improve


From: Werner Lemberg
Subject: [freetype2] master 30b0ce730: src/psaux/psintrp.c (cf2_escSQRT): Improve initial guess.
Date: Mon, 11 Sep 2023 12:34:50 -0400 (EDT)

branch: master
commit 30b0ce730354496fe30717b5871165b77c42ac33
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    src/psaux/psintrp.c (cf2_escSQRT): Improve initial guess.
    
    The worst number of iterations decreased from 11 to 5.
---
 src/psaux/psintrp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index 6c640eebd..fcd49ee0e 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -37,6 +37,7 @@
 
 
 #include "psft.h"
+#include <freetype/internal/ftcalc.h>
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/services/svcfftl.h>
 
@@ -2276,9 +2277,8 @@
                     arg = cf2_stack_popFixed( opStack );
                     if ( arg > 0 )
                     {
-                      /* use a start value that doesn't make */
-                      /* the algorithm's addition overflow   */
-                      FT_Fixed  root = arg < 10 ? arg : arg >> 1;
+                      /* initial guess based on the most significant bit */
+                      FT_Fixed  root = 1 << ( ( 17 + FT_MSB( arg ) ) >> 1 );
                       FT_Fixed  new_root;
 
 



reply via email to

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