判断一个数是不是2的幂次方

int judge(int a){

return ((a&(a-1))==0);

}

比如100000&(011111)==0.

posted @ 2012-10-24 10:01  xxx's blog  阅读(153)  评论(0编辑  收藏  举报