📜  count bits c++代码示例

📅  最后修改于: 2022-03-11 14:44:45.929000             🧑  作者: Mango

代码示例1
//Method 1
   int count = 0;
   while (n)
   {
        count++;
        n >>= 1;
    }
//Method 2
    int count = (int)log2(number)+1;