On 5/19/15 5:32 PM, deadalnix wrote:
On Tuesday, 19 May 2015 at 20:09:23 UTC, Steven Schveighoffer wrote:
On 5/19/15 4:01 PM, deadalnix wrote:
Have you tried things like :

(x >> bsr(x)) == 1 ?

I have no idea if this is faster or not, but worth trying.

Hm.. I think this would always succeed. Perhaps you mean:

1 << bsr(x) == x;


Both work as long as you use a fully defined instruction, like tzcnt.

Hm... I messed up, (x >> bsr(x)) is always zero. I think you meant to write:

x >> (bsr(x) - 1)

which always is 1.

Either way, it doesn't work.

-Steve

Reply via email to