jcdctmgr.c
/*
 * Find the highest bit in an integer through binary search.
 */
Find the highest bit in an integer through binary search.
Find the highest bit in an integer through binary search .
LOCAL(int)
flss (UINT16 val)
{
  int bit;
  bit = 16;
  if (!val)
    return 0;
  if (!(val & 0xff00)) {
    bit -= 8;
    val <<= 8;
  }
  if (!(val & 0xf000)) {
    bit -= 4;
    val <<= 4;
  }
  if (!(val & 0xc000)) {
    bit -= 2;
    val <<= 2;
  }
  if (!(val & 0x8000)) {
    bit -= 1;
    val <<= 1;
  }
  return bit;
}
LOCAL ( int ) flss ( UINT16 val ) { int bit ; bit = 16 ; if ( ! val ) return 0 ; if ( ! ( val & 0xff00 ) ) { bit -= 8 ; val <<= 8 ; } if ( ! ( val & 0xf000 ) ) { bit -= 4 ; val <<= 4 ; } if ( ! ( val & 0xc000 ) ) { bit -= 2 ; val <<= 2 ; } if ( ! ( val & 0x8000 ) ) { bit -= 1 ; val <<= 1 ; } return bit ; }
Find the highest bit in an integer through binary search.
Find the highest bit in an integer through binary search .