Implement the integral part logn base 2 with bit manipulations

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Implement the integral part logn base 2 with bit manipulations相关的知识,希望对你有一定的参考价值。

Implement the integral part logn base 2 with bit manipulations

 

int integralPartOfLog(unsigned int n)
{

    int ret = 0;
    
    while (n > 0) {
        n = n>>1;
        ret++;
    }
    
    return ret-1;
}

 

以上是关于Implement the integral part logn base 2 with bit manipulations的主要内容,如果未能解决你的问题,请参考以下文章

The type RoadActivity must implement the inherited abstract method求救

Box<dyn Trait> doesn‘t implement the trait

Box<dyn Trait> doesn‘t implement the trait

JMX MBean class xxx does not implement DynamicMBean, and neither follows the Standard MBean conventi

can not implement the missing methods,either due to compile errors or the projects build path does(示

java报错提示The method xxx must override or implement a supertype method