判断x是否为2的n次幂

常用方法:

1 x&(x=1);

该表达式若为0,则为2的n次幂。

例如:

1 1000&0111=00002 10000&01111=00000;
原文地址:https://www.cnblogs.com/qijunhui/p/8284148.html