0 is not a power of 2

Jay Norwood via Digitalmars-d digitalmars-d at puremagic.com
Fri May 22 12:51:46 PDT 2015


On Friday, 22 May 2015 at 05:24:15 UTC, Jay Norwood wrote:

> first result uses
> if (((x-1)&(x|0x80000000))==0)

00F81005  mov         eax,edx
00F81007  lea         ecx,[edx-1]
00F8100A  or          eax,80000000h
00F8100F  test        ecx,eax

Above is what a Microsoft C++ compiler does with the first 
expression.  It gets inserted in-line in the test.


More information about the Digitalmars-d mailing list