0 is not a power of 2

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu May 21 14:22:39 PDT 2015


On 5/21/15 4:46 PM, deadalnix wrote:

> Alternatively, with bsf on could do:
>
> x << bsf(x) == 1 << [32|64]

Hm... bsf does work in your original code, I'm thinking you may have 
messed up bsf and bsr :)

x >> bsf(x) == 1

Which makes a LOT more sense (I tested and it works).

Don't ask me why I knew bsr vs. bsf...

-Steve


More information about the Digitalmars-d mailing list