This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Bitwise shift operator on 8-byte integers
- From: Krzysztof dot Wisniowski at siemens dot com
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 5 Oct 2004 17:59:25 +0200
- Subject: 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