判断是否为2的N次方

时间:2014-05-23 13:56:31
【文件属性】:
文件名称:判断是否为2的N次方
文件大小:3KB
文件格式:RAR
更新时间:2014-05-23 13:56:31
2的N次方 用C语言来定义一个宏用来判断一个数是否为2的N次方。并附有测试程序
【文件预览】:
2ofNPower
----test(6KB)
----check2OfNPower.h(172B)
----makefile(250B)
----test.c(267B)

网友评论

  • 写的不错 简单明了 还有其他方法 (n>0)&&(( n & ( (~n) + 1 ) ) == n)) (n & (n-1)) == 0 && n (n> 0)&&!(n^(!n))