阅读背景:

如何使用按位运算符计算机记录基数2?

来源:互联网 

I need to compute the log base 2 of a number in C but I cannot use the math library. The answer doesn't need to be exact, just to the closest int. I've thought about it and I know I could just use a while loop and keep dividing the number by 2 until it is < 2, and keep count of the iterations, but is this possible using bitwise operators?I need to compute the log base 2 of a number in




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: