suibenzhi
7/13/2018 - 3:45 PM

判断一个数是否是2的方幂.cpp


static inline bool is_power_of_two(int64_t x)
{
    return ((x) != 0 && (((x) & ((x) - 1)) == 0));
}