freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] Update 2 files


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] Update 2 files
Date: Wed, 13 Sep 2023 17:02:38 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 6eb5f2be
    by Alexei Podtelezhnikov at 2023-09-13T17:02:31+00:00
    Update 2 files
    
    - /src/base/ftcalc.c
    - /include/freetype/internal/ftcalc.h

2 changed files:

Changes:

  • include/freetype/internal/ftcalc.h
    ... ... @@ -509,8 +509,8 @@ FT_BEGIN_HEADER
    509 509
        * @note:
    
    510 510
        *   This function is not very fast.
    
    511 511
        */
    
    512
    -  FT_BASE( FT_Int32 )
    
    513
    -  FT_SqrtFixed( FT_Int32  x );
    
    512
    +  FT_BASE( FT_UInt32 )
    
    513
    +  FT_SqrtFixed( FT_UInt32  x );
    
    514 514
     
    
    515 515
     #endif /* 0 */
    
    516 516
     
    

  • src/base/ftcalc.c
    ... ... @@ -917,36 +917,29 @@
    917 917
     
    
    918 918
       /* documentation is in ftcalc.h */
    
    919 919
     
    
    920
    -  FT_BASE_DEF( FT_Int32 )
    
    921
    -  FT_SqrtFixed( FT_Int32  x )
    
    920
    +  /* Algorithm and code by Christophe Meessen (1993). */
    
    921
    +  FT_BASE_DEF( FT_UInt32 )
    
    922
    +  FT_SqrtFixed( FT_UInt32  r )
    
    922 923
       {
    
    923
    -    FT_UInt32  root, rem_hi, rem_lo, test_div;
    
    924
    -    FT_Int     count;
    
    924
    +    FT_UInt32  t, q, b;
    
    925 925
     
    
    926 926
     
    
    927
    -    root = 0;
    
    927
    +    q = 0;
    
    928 928
     
    
    929
    -    if ( x > 0 )
    
    929
    +    b = 0x40000000;
    
    930
    +    while ( b > 0x40 )
    
    930 931
         {
    
    931
    -      rem_hi = 0;
    
    932
    -      rem_lo = (FT_UInt32)x;
    
    933
    -      count  = 24;
    
    934
    -      do
    
    932
    +      t = q + b;
    
    933
    +      if ( r >= t )
    
    935 934
           {
    
    936
    -        rem_hi   = ( rem_hi << 2 ) | ( rem_lo >> 30 );
    
    937
    -        rem_lo <<= 2;
    
    938
    -        root   <<= 1;
    
    939
    -        test_div = ( root << 1 ) + 1;
    
    940
    -
    
    941
    -        if ( rem_hi >= test_div )
    
    942
    -        {
    
    943
    -          rem_hi -= test_div;
    
    944
    -          root   += 1;
    
    945
    -        }
    
    946
    -      } while ( --count );
    
    935
    +        r -= t;
    
    936
    +        q  = t + b;  /* equivalent to q += 2*b */
    
    937
    +      }
    
    938
    +      r <<= 1;
    
    939
    +      b >>= 1;
    
    947 940
         }
    
    948 941
     
    
    949
    -    return (FT_Int32)root;
    
    942
    +    return q >> 8;
    
    950 943
       }
    
    951 944
     
    
    952 945
     #endif /* 0 */
    


  • reply via email to

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