0 is not a power of 2
w0rp via Digitalmars-d
digitalmars-d at puremagic.com
Tue May 19 03:59:52 PDT 2015
I believe you can also do x & -x == x. I'm not sure if that will
be actually faster or slower. You could maybe cut the
instructions down a little with an asm{} block. The compiler
might not figure out that it can re-use a register for x on the
left and x on the right there. You might use popcnt in a
version() block too, so you can use the instruction when you've
got it.
More information about the Digitalmars-d
mailing list