D - dmd -O bug & conversion to short bug
- dickl (29/29) Jan 18 2004 The following code produces the wrong results when compiled with the -O
The following code produces the wrong results when compiled with the -O
switch
for the routines not defined as extern(C). Those defined as extern(C) work
fine.This bug
was reported previously but was not fixed in the lastest version.
Also, the functions are supposed to return a short, but in some case they
return a 32bit number
int main()
{
short s=HIWORD(0xFFFDDDD); //returns 0xFFFDDDD & 32bit short when -O is
used !
short t=LOWORD(0xFFFFCCCC); // always returns a 32bit short !
short v=HIWORD_(0xFFFEEEE); // works with -O & returns a short
printf("%x %x %x %x\n",s,t,v,x);
return 0;
}
short HIWORD(uint i)
{
return (short)(( i >> 16) & 0xFFFF);
}
short LOWORD(uint i)
{
return (short)i;
}
extern (C) short HIWORD_(uint i)
{
return (short)(( i >> 16) & 0xFFFF);
}
Jan 18 2004








"dickl" <dick221z yahoo.com>