📜  isPowerOfTwo - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:40.881000             🧑  作者: Mango

代码示例1
bool isPowerOfTwo(int x)
    {
        // x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
        return (x && !(x & (x - 1)));
    }