普通方法是循环
其实可以用位运算
整型范围内适用。
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
++n;
普通方法是循环
其实可以用位运算
整型范围内适用。
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
++n;