shithub: freetype+ttf2subf

Download patch

ref: c0a6f20a4b33fefce50dafbf0d7f20aec6b0e724
parent: 177982e933ed6f2ab96163e14f4267f8abe89efd
author: Alexei Podtelezhnikov <[email protected]>
date: Wed Jul 16 18:05:56 EDT 2014

Replace `ft_highpow2' function.

* src/pfr/pfrobjs.c (pfr_face_get_kerning): Use `FT_MSB' instead of
`ft_highpow2'.

* src/base/ftutil.c, include/internal/ftobjs.h (ft_highpow2): Remove
it.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2014-07-16  Alexei Podtelezhnikov  <[email protected]>
+
+	Replace `ft_highpow2' function.
+
+	* src/pfr/pfrobjs.c (pfr_face_get_kerning): Use `FT_MSB' instead of
+	`ft_highpow2'.
+
+	* src/base/ftutil.c, include/internal/ftobjs.h (ft_highpow2): Remove
+	it.
+
 2014-07-15  Alexei Podtelezhnikov  <[email protected]>
 
 	* src/base/ftcalc.c (FT_MSB): Utilize gcc builtins. 
--- a/include/internal/ftobjs.h
+++ b/include/internal/ftobjs.h
@@ -83,14 +83,6 @@
 
 
   /*
-   *  Return the highest power of 2 that is <= value; this correspond to
-   *  the highest bit in a given 32-bit value.
-   */
-  FT_BASE( FT_UInt32 )
-  ft_highpow2( FT_UInt32  value );
-
-
-  /*
    *  character classification functions -- since these are used to parse
    *  font files, we must not use those in <ctypes.h> which are
    *  locale-dependent
--- a/src/base/ftutil.c
+++ b/src/base/ftutil.c
@@ -411,26 +411,4 @@
   }
 
 
-  FT_BASE_DEF( FT_UInt32 )
-  ft_highpow2( FT_UInt32  value )
-  {
-    FT_UInt32  value2;
-
-
-    /*
-     *  We simply clear the lowest bit in each iteration.  When
-     *  we reach 0, we know that the previous value was our result.
-     */
-    for ( ;; )
-    {
-      value2 = value & (value - 1);  /* clear lowest bit */
-      if ( value2 == 0 )
-        break;
-
-      value = value2;
-    }
-    return value;
-  }
-
-
 /* END */
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -515,7 +515,7 @@
       {
         FT_UInt    count       = item->pair_count;
         FT_UInt    size        = item->pair_size;
-        FT_UInt    power       = (FT_UInt)ft_highpow2( (FT_UInt32)count );
+        FT_UInt    power       = 1 << FT_MSB( count );
         FT_UInt    probe       = power * size;
         FT_UInt    extra       = count - power;
         FT_Byte*   base        = stream->cursor;