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; }
时间: 2024-07-30 09:46:28
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; }