[base] Use more common `FT_MSB' implementation with masks. * src/base/ftcalc.c (FT_MSB): Updated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
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;