各位大大好,
請問如果給您選擇,
您會選哪個函式來找出MSB呢?
int get_highest_bit_position(unsigned char x)
{
int n = 7;
if (x == 0) return -1;
if ((x >> 4) == 0) { n = n-4; x=x << 4;}
if ((x >> 6) == 0) { n = n-2; x=x << 2;}
if ((x >> 7) == 0) { n = n-1;}
return n;
}
int get_highest_bit_position(unsigned char x){
for(int i = 7; i >= 0 ;