RE: right shift : strange behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Manish,

Because of C promotion rules, you are probably seeing this on your platform (other platforms may have different behavior, depending on the bit-sizes of long and int):

0x0 is taken to be a signed int.

0xFFFFFFFF is taken to be an unsigned int.

If you want 0xFFFFFFFF to be treated as a signed int, do this:

((signed int)0xFFFFFFFF)

If you want 0x0 to be treated as an unsigned int, do one of these;
0x0U
((unsigned int)0x0)

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux