C语言快速取以2为底的对数的方法
int FastLog2(int x) { float fx; unsigned long ix, exp; fx = (float)x; ix = *(unsigned long*)&fx; exp = (ix >> 23) & 0xFF; return exp - 127; }
C语言快速取以2为底的对数的方法
int FastLog2(int x) { float fx; unsigned long ix, exp; fx = (float)x; ix = *(unsigned long*)&fx; exp = (ix >> 23) & 0xFF; return exp - 127; }