Bitwise shift operator on 8-byte integers

Krzysztof.Wisniowski@siemens.com Krzysztof.Wisniowski@siemens.com
Tue Oct 5 15:59:00 GMT 2004


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 



More information about the Gcc-help mailing list