static bool powerof2(int n)
{
return ((n & (n - 1)) == 0);
}
位运算积累
判断整数是否为2的幂次方
最新推荐文章于 2025-08-03 15:31:35 发布
判断整数是否为2的幂次方
static bool powerof2(int n)
{
return ((n & (n - 1)) == 0);
}
1134
1872

被折叠的 条评论
为什么被折叠?