Pete French
Tue, 12 Dec 2000 10:37:06 -0800
> What about that: (-1)^(-1>>1) ?
the casts break it - the cosntant "-1" has the type of 'signed int' so
when you do a >> on it the sign bit is preserved.
int a;
a = -1;
printf("a in hex is %x\n",a);
a = a >> 1;
printf("a in hex is %x\n",a);
produces the output:
a in hex is ffffffff
a in hex is ffffffff
which is not what you expect!
-bat.
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]