Commit 418e18f3df04fdfbec597482182769dcf21963e2

Alexei Podtelezhnikov 2014-10-01T22:36:40

[base] Use more common `FT_MSB' implementation with masks. * src/base/ftcalc.c (FT_MSB): Updated.

diff --git a/ChangeLog b/ChangeLog
index 4e26bde..9a38f8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[base] Use more common `FT_MSB' implementation with masks.
+
+	* src/base/ftcalc.c (FT_MSB): Updated.
+
 2014-09-30  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	[base] Clean up.
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 13bd656..3db3f8b 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -118,27 +118,27 @@
     FT_Int shift = 0;
 
     /* determine msb bit index in `shift' */
-    if ( z >= ( 1L << 16 ) )
+    if ( z & 0xFFFF0000U )
     {
       z     >>= 16;
       shift  += 16;
     }
-    if ( z >= ( 1L << 8 ) )
+    if ( z & 0x0000FF00U )
     {
       z     >>= 8;
       shift  += 8;
     }
-    if ( z >= ( 1L << 4 ) )
+    if ( z & 0x000000F0U )
     {
       z     >>= 4;
       shift  += 4;
     }
-    if ( z >= ( 1L << 2 ) )
+    if ( z & 0x0000000CU )
     {
       z     >>= 2;
       shift  += 2;
     }
-    if ( z >= ( 1L << 1 ) )
+    if ( z & 0x00000002U )
     {
    /* z     >>= 1; */
       shift  += 1;