News for hackers. Stuff that matters.
Re:Ten Ways to Check if an Integer Is a Power Of Two in C by wnoise on Tuesday July 26, 2011 @12:24PM (#2808074)
2^(bitsize) == 0.

Edit: Yes, 1 << bitsize is undefined. But unsigned integers actually do have well-defined semantics on overflow, and multiplying by 2 enough times really does produce zero.

Re:Ten Ways to Check if an Integer Is a Power Of Two in C by rcfox on Tuesday July 26, 2011 @12:48PM (#2808224)
Actually, it's undefined behaviour. http://blog.regehr.org/archives/213
Re:Ten Ways to Check if an Integer Is a Power Of Two in C by ot on Tuesday July 26, 2011 @12:49PM (#2808229)
2^(bitsize) == 2^(bitsize)

If you meant 1 << (bitsize), that's undefined behaviour in C