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

SubmittedTitle on HNPointsComments
Jul 26, 2011Ten Ways to Check if an Integer Is a Power Of Two in C by caustic11473

More from Rick Regan (Exploring Binary)

All 3 posts →

Related posts from the same era