Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
cube13
on July 26, 2011
|
parent
|
context
|
favorite
| on:
Ten Ways to Check if an Integer Is a Power Of Two ...
This works for negative values of x, though.
It should be: ((x>0) && ((x & -x) == x))
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
It should be: ((x>0) && ((x & -x) == x))