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的主要内容,如果未能解决你的问题,请参考以下文章