diff --git a/isPower2 b/isPower2 new file mode 100644 index 0000000..025b796 --- /dev/null +++ b/isPower2 @@ -0,0 +1,4 @@ +int isPower2(int x){ + int res = ((!((1 << 31) & x)) & (!(x & (x + (~0)))) & (!!x)); + return res; +}