Yer right.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of retired mainframer
Sent: Thursday, May 08, 2014 3:31 PM
To: [email protected]
Subject: Re: Another C compiler shift bug?

:>: -----Original Message-----
:>: From: IBM Mainframe Discussion List [mailto:[email protected]] On
:>: Behalf Of Charles Mills
:>: Sent: Thursday, May 08, 2014 3:16 PM
:>: To: [email protected]
:>: Subject: Another C compiler shift bug?
:>:
:>: Am I missing something here? Consider the following C statement:
:>:
:>: unsigned long long maxBit = 0x1 << (arraySize-3);
:>:
:>: When arraySize is 66, maxBit is ending up as zero (instead of what I
:>: would
:>: expect, X'8000000000000000'. Am I missing something?

0x1 is an unsigned int.  The shift is performed on this value (resulting in
0) which is then converted to unsigned long long.  Change the constant to
0x1ULL and try.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to