hth - http:// ivan.vecerina.com http://www.brainbench.com <> Brainbench MVP for C ++isPow2 = x && !( (x-1) & x );See http://www.caam.rice.edu/~dougm/twiddle/for some related info.hth-- http://ivan.vecerina.com http://www.brainbench.com <> Brainbench MVP for C++ 我们不是来为你做功课。 - Keith Thompson(The_Other_Keith) ks*@cts.com < http://www.ghoti.net/~kst> ; 圣地亚哥超级计算机中心< *> < http://www.sdsc.edu/~kst> Schroedinger做莎士比亚:要*和*不要We''re not here to do your homework for you.--Keith Thompson (The_Other_Keith) ks*@cts.com <http://www.ghoti.net/~kst>San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>Schroedinger does Shakespeare: "To be *and* not to be" 这篇关于测试一个数是否是2的幂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!