Rick Regan (Exploring Binary) personal blog
Ten Ways to Check if an Integer Is a Power Of Two in C
To write a program to check if an integer is a power of two, you could follow two basic strategies: check the number based on its decimal value, or check it based on its binary representation. The former approach is more human-friendly but generally less efficient; the latter approach is more machine-friendly but…
- Points
- 114
- HN comments
- 73
- Submissions
- 1
- Cited by
- 0 commenters
Software EngineeringMath & Algorithms2011
On Hacker News
| Submitted | Title on HN | Points | Comments |
|---|---|---|---|
| Jul 26, 2011 | Ten Ways to Check if an Integer Is a Power Of Two in C by caustic | 114 | 73 |