This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bitwise shift operator on 8-byte integers


Hallo *, 
Here's the problem:

unsigned int ui = 4294967295; //2^16-1
unsigned long long uL; //8-byte variable

uL = ui << 16;

The outcome of this operation is 4294901760, meaning that 16 bits were
shifted to "nowhere".
Seems to me that bitwise shift operator does not work over 32-bit limit.
Is there a simple work around this problem?

BR,
-- 
Krzysztof Wisniowski   | Siemens Sp. z o.o.
ICM SDC NMR 3          | Software Design Center
Phone: +48 71 799 2403 | 54A Strzegomska Str.
Fax: +48 71 799 2320   | 53-611 Wroclaw POLAND 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]