0 is not a power of 2

Brian Schott via Digitalmars-d digitalmars-d at puremagic.com
Tue May 19 13:41:57 PDT 2015


On Tuesday, 19 May 2015 at 20:01:29 UTC, deadalnix wrote:
> Have you tried things like :
>
> (x >> bsr(x)) == 1 ?
>
> I have no idea if this is faster or not, but worth trying.

https://issues.dlang.org/show_bug.cgi?id=14380

"If the content source operand is 0, the content of the 
destination operand is undefined" - This applies to both the bsf 
and bsr instructions.


More information about the Digitalmars-d mailing list