Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
chime
on July 26, 2011
|
parent
|
context
|
favorite
| on:
Ten Ways to Check if an Integer Is a Power Of Two ...
That was #9:
int isPowerOfTwo (unsigned int x) { return ((x != 0) && !(x & (x - 1))); }
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: