首页 > 其他 > 详细

Implement the integral part logn base 2 with bit manipulations

时间:2016-01-27 12:54:29      阅读:106      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/hygeia/p/5162672.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!