#include<stdio.h>
int ilog2(int x){
float floatx=(float)x;
float *floatax=&floatx;
unsigned int index,*address;
address=(unsigned int *)floatax;
index=(*address>>23)&0xff;
int rev=index-127;
return rev;
}int main(){
int x;
scanf("%d",&x);
printf("%d\n",ilog2(x));
return 0;
}
求一个数的对数(抡底层实现)
最新推荐文章于 2023-10-07 17:45:28 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)