On 5/19/15 1:46 PM, 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);
> }
Nice code with dmd and gdc. Thanks!
https://github.com/andralex/phobos/commit/ec197ecd203b0ea25201acfeb4fbbb13b2fabb7f
-- Andrei