Implement the integral part logn base 2 with bit manipulations

mac2022-06-30  72

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; }

 

转载于:https://www.cnblogs.com/hygeia/p/5162672.html

最新回复(0)