std.math.isPowerOf2

safety0ff via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 1 20:45:44 PDT 2016


On Sunday, 2 October 2016 at 03:05:37 UTC, Manu wrote:
> Unsigned case is:
>   return (x & -x) > (x - 1);
>
> Wouldn't this be better:
>   return (sz & (sz-1)) == 0;
>

https://forum.dlang.org/post/nfkaag$2d6u$1@digitalmars.com




More information about the Digitalmars-d mailing list