[base] Use more common `FT_MSB' implementation with masks.

* src/base/ftcalc.c (FT_MSB): Updated.
This commit is contained in:
Alexei Podtelezhnikov 2014-10-01 22:36:40 -04:00
parent 955aff12c0
commit 418e18f3df
2 changed files with 11 additions and 5 deletions

View File

@ -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> 2014-09-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Clean up. [base] Clean up.

View File

@ -118,27 +118,27 @@
FT_Int shift = 0; FT_Int shift = 0;
/* determine msb bit index in `shift' */ /* determine msb bit index in `shift' */
if ( z >= ( 1L << 16 ) ) if ( z & 0xFFFF0000U )
{ {
z >>= 16; z >>= 16;
shift += 16; shift += 16;
} }
if ( z >= ( 1L << 8 ) ) if ( z & 0x0000FF00U )
{ {
z >>= 8; z >>= 8;
shift += 8; shift += 8;
} }
if ( z >= ( 1L << 4 ) ) if ( z & 0x000000F0U )
{ {
z >>= 4; z >>= 4;
shift += 4; shift += 4;
} }
if ( z >= ( 1L << 2 ) ) if ( z & 0x0000000CU )
{ {
z >>= 2; z >>= 2;
shift += 2; shift += 2;
} }
if ( z >= ( 1L << 1 ) ) if ( z & 0x00000002U )
{ {
/* z >>= 1; */ /* z >>= 1; */
shift += 1; shift += 1;