On Tuesday, 19 May 2015 at 20:46:09 UTC, Matthias Bentrup wrote:
I think you can make the over/underflow at zero work in your favor:

bool isPowerOf2(uint x)
{
  return (x & -x) > (x - 1);
}

Very nice

Reply via email to