标签:
Given an integer, write a function to determine if it is a power of two.
1 bool isPowerOfTwo(int n) { 2 if(n<=0) 3 return false; 4 if(n&(n-1)) 5 return false; 6 else 7 return true; 8 }
Power of Two
原文地址:http://www.cnblogs.com/zl1991/p/4670111.html